TreeNode objects inaccesible during postback

Discussion in 'ASP .Net Web Controls' started by Phil H, Oct 10, 2006.

  1. Phil H

    Phil H Guest

    Hi

    Can anyone tell why the SelectedNode property of a TreeView is
    sometimes inaccessible during a postback event?

    I developed a small web application recently that features a TreeView.
    The nodes are created programatically but the TreeView itself is
    created at design time.

    I also used a mulitview object and several views, the Tree being in one
    of them. I found that I can access the tree during postback events so
    long as it is generated by a control in the same view as the tree (i.e.
    the host view set active) but if I switch to another view and then
    process events from controls there the SelectNode property returns null
    (or nothing in VB).

    The curious thing is that the Tree is recreated in tact with the same
    selected node when the view is re-activated, ie. it is preserved by
    Viewstate. Yet I can access controls in other hidden views (e.g.label
    objects) from the view containing the tree any time I like.

    Has this got anything to do with the fact that the nodes are created
    programatically?

    I've had this sort of anxst before with VS2003. I get terribly confused
    over what is preserved and what is not between postbacks.

    I'd be very greatful to anyone who can shed some light on this.
     
    Phil H, Oct 10, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Spendius
    Replies:
    0
    Views:
    621
    Spendius
    Sep 30, 2003
  2. tanya foster
    Replies:
    3
    Views:
    3,786
    tanya foster
    May 18, 2006
  3. traveller
    Replies:
    0
    Views:
    1,246
    traveller
    Jan 8, 2008
  4. ton
    Replies:
    0
    Views:
    522
  5. John Bankhead

    Custom TreeNode typing lost after postback

    John Bankhead, Oct 30, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    213
    John Bankhead
    Oct 30, 2006
Loading...

Share This Page