|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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
|
|
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)?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
|
|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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=1366Thanks
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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=1186Thanks
|
|
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.
|
|