Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Expand TreeView programmatically (ASP.NET 2.0) (http://www.velocityreviews.com/forums/t776964-expand-treeview-programmatically-asp-net-2-0-a.html)

Karim El Jed 10-06-2005 12:35 PM

Expand TreeView programmatically (ASP.NET 2.0)
 
Hi,

I'm trying to expand a special Node of my TreeView from Codebehind.
I have a TreeView on a page for navigating to another site. On the other
tsite here is the same TreeView more precisely a new TreeView with the same
nodes ;)
So I would like to keep the expanding state of the first Tree for the second
one on the next page. At least the last selected node (path will be saved in
query string) should be expanded.

Remarks: The TreeView is rendered in an IFrame to enable scrolling. Maybe
there might be another solution. Let me know if someone knows ;)

Here is what I tried:

protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
//Populate the Tree
TreeView1.Nodes.Add(TopicFactory.PopulateTopicTree Nodes());
TreeView1.Target = "_parent";

if (Request.QueryString["path"] != null)
{
//path for the node is in the query string
string path = Request.QueryString["path"];
TreeNode selected = TreeView1.FindNode(path);

if (selected != null)
{
//expand the node belonging to the given path
selected.Expand();
}
}
}
}

Finding the node is no problem. But it seems the method Expand() has no
effect :(

I hope someone can help.

Greetings

Karim




All times are GMT. The time now is 06:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.