Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 22995 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > Problem with maintaining treeview state ...
Shoyebaziz123

Problem with maintaining treeview state

Replies: 0 | Posted by: Shoyebaziz123 on 7/19/2012 | Category: ASP.NET Forums | Views: 447 | Status: [Member] | Points: 10  


Hi All,

I have a nested master page configuration application... firstly there is only ParentMaster with only menubar .. after selection of menu item a page with treeview must be open and selecting treeview item a second menu should be appear beneath menubar(1) , and selecting from this second menu content pages open having right side with treeview and left side with controls.

for this purpose i have created a master page with only menu , and another master page with another menu at top and left side with tree and right side with a content palce holder , setting its master page as Parentmaster . aftre selection of menu item i am filling treeview from db, then changing node from treeview i am filling second menu of nested page . then selecting menuitem from nested master page i am navigationg to diffrent pages . All of this working fine , but there is a problem that if i select Node1's child node node1 expanded then selecting menuitem navigate to page but now in this page if i expand Node3 and select its child node and the selcting menuitem Node3 is collapsed ( which must be expanded) and Node 1 is expanded(ok) .
I have wittenn the code for saving treeview state like this

private void SaveTreeViewState(TreeNodeCollection nodes, List<string> list)
{
// Recursivley record all expanded nodes in the List.
foreach (TreeNode node in nodes)
{
if (node.ChildNodes != null && node.ChildNodes.Count != 0)
{
if (node.Expanded.HasValue && node.Expanded == true && !String.IsNullOrEmpty(node.Text))
list.Add(node.Text);
SaveTreeViewState(node.ChildNodes, list);
}
}
}

( there is also code for restoring state)

while i am debugging from content page after clicking Node3 the conditon " node.Expanded == true " is showing false which must be true
although i have expanded the node ...

what i have to do now ?


Thanks


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

  No reply found.


Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/20/2013 5:34:44 AM