Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Treeview selected Node

Reply
Thread Tools

Treeview selected Node

 
 
Vikram
Guest
Posts: n/a
 
      08-14-2007
Hi,

I am using Asp.net 2.0 treeview control.Tree is having 2-3 level of
hirearechy. I want to show current selected node as expanded when the page
reloads or postback. How can I do that?

Thanks

 
Reply With Quote
 
 
 
 
Antoine Griffard
Guest
Posts: n/a
 
      08-14-2007
Hi,

Try this :
protected void tv_PreRender(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (tv.SelectedNode != null)
tv.SelectedNode.Expand();
}
}

Tonio - MVP,
http://www.wygwam.com
http://blogs.developpeur.org/tonio


 
Reply With Quote
 
 
 
 
Ladislav Mrnka
Guest
Posts: n/a
 
      08-14-2007
Hi Vikram,

try to set SelectAction in your nodes to Expand. Be aware of impact on
TreeView functionality. Changing SelectAction can affect which events are
fired when user click on node. For expand mode it will not fire
SelectedNodeChanged any more.

You can also handle SelectedNodeChanged, collapse all nodes and then expand
only selected node if you want to.

Regards,
Ladislav

"Vikram" wrote:

> Hi,
>
> I am using Asp.net 2.0 treeview control.Tree is having 2-3 level of
> hirearechy. I want to show current selected node as expanded when the page
> reloads or postback. How can I do that?
>
> Thanks
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView node style - for an individual node Homer J. Simpson ASP .Net 5 07-24-2007 10:04 PM
How to find node in TreeView by using string(the same as Node.Text) ? jiing ASP .Net 0 04-27-2007 02:34 AM
xsl variable $node/text() but $node can non-node-set help! Tjerk Wolterink XML 2 08-24-2006 03:28 AM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
How to drag a sub-node to another node in TreeView? wolf ASP .Net 0 08-18-2004 11:51 PM



Advertisments