Welcome Guest Search | Active Topics | Sign In | Register

Treeview with Contextmenu inside a call back panel Options
Biju
Posted: Tuesday, July 15, 2008 9:27:33 PM
Rank: Member
Groups: Member

Joined: 6/3/2008
Posts: 26
I have created a treeview with context menu items Add, Edit and Delete and which is put inside a Callback panel.
From the server side code ,
1. How I can display the context node in edit mode ?
2. How I can delete a node at level 5 with index 3? Any function is available to delete the node by giving its Path? Any function is available to delete a ContextNode?
3. How I can add a new node to the treeview at a particular position say level 7 at index 4 and put it in edit mode?
eo_support
Posted: Wednesday, July 16, 2008 1:32:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
Hi,

You can not do #1 and #3 from server side. You can do #2 by code by something like TreeView1.Nodes[0].ChildNodes[0]....RemoveAt(2); You do not need a function that delete the node by path. You do something like this:

EO.Web.TreeNode node = (EO.Web.TreeNode)TreeView1.FindItem(path);
node.ParentNode.ChildNodes.Remove(node);

Thanks
Biju
Posted: Wednesday, July 16, 2008 1:49:40 AM
Rank: Member
Groups: Member

Joined: 6/3/2008
Posts: 26
Thanks, #2 is working fine.
Can I do #1 and #3 from Client side.
Can I display the contextnode in edit mode ( ie, the text of the node will be displayed in a textbox for editing)?
If I set AllowEdit of the treeview as True, then I can edit the node by double clicking on it. In the same way, Is there be any function available in the Client or Server side for displaying the node in the edit mode?
Can I use the context menu item Edit for simulating the double click effect (ie, the node is displayed in edit mode)?
eo_support
Posted: Wednesday, July 16, 2008 7:52:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
Here you go:

http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.TreeNode.beginEdit.html

You will need to use other JavaScript interface to get the TreeNode object first.

Complete JavaScript reference at here:

http://www.essentialobjects.com/ViewDoc.aspx?t=clientapi_howto.html

Thanks
Biju
Posted: Thursday, July 17, 2008 10:33:57 AM
Rank: Member
Groups: Member

Joined: 6/3/2008
Posts: 26

Thanks for the support you have provided me to sorted out the issues.

Now everything working fine except #3. Now I will be able to add a new node under the context node. For adding the new node, I am using server side function. After that I need to display that node in edit mode. For that , I need to execute BeginEdit() from the client side. How can I acheive that?
eo_support
Posted: Thursday, July 17, 2008 10:36:33 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
Hi,

You can render a small piece of JavaScript to do that. Please see this post on how to render JavaScript from server side:

http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=1366

Thanks
Biju
Posted: Wednesday, July 23, 2008 12:20:24 AM
Rank: Member
Groups: Member

Joined: 6/3/2008
Posts: 26
Hi,
Currently, I am using EO.Web 2008 controls. For populating the treeview, I am using the following code and this function is called from Page_Load event.

Private Sub CreateTreeView()
Dim strLookup As String
Dim xmlLookup As New XmlDocument
Dim objDSLookup As XmlDataSource
Dim objDataBinding As EO.Web.DataBinding
Dim sys_block As Integer = Request.QueryString("sys_block")
Try
strLookup = objConnect.ScalarExecuteSQL_String("select XML_LOOKUP FROM [tbl_Lookup] WHERE sys_block=" & sys_block)
xmlLookup.LoadXml(strLookup)
objDSLookup = New XmlDataSource
objDSLookup.Data = xmlLookup.OuterXml
TreeView1.DataSource = objDSLookup
objDSLookup.XPath = "/*/*"
objDataBinding = New EO.Web.DataBinding
objDataBinding.Property = "Text-Html"
objDataBinding.DataField = "@Text"
TreeView1.Bindings.Add(objDataBinding)
TreeView1.DataBind()
TreeView1.ExpandAll()
Catch ex As Exception
End Try

End Sub

The code is working fine. But always the treeview is displaying the same data. Even if the contect in the datasourec is changing, it will never reflect in the treeview.
eo_support
Posted: Wednesday, July 23, 2008 6:19:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,097
Hi,

Your code looks fine. You may want to check out this page and see if it works for you:

http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=1186

Thanks
Biju
Posted: Wednesday, July 23, 2008 11:58:09 PM
Rank: Member
Groups: Member

Joined: 6/3/2008
Posts: 26
Thanks for your support.

Now the issue is solved. The issue was related with the xml datasource. For refreshing the treeview we have to set the EnableCashing property of the xml datasource to false.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.