Treeview state in a master page

Discussion in 'ASP .Net Web Controls' started by Vikram, Aug 22, 2007.

  1. Vikram

    Vikram Guest

    Hi,
    I am using a treeview control in a master page. On click of any node I am
    opening new page and all pages are incorporated in master page. Now I want to
    maintain state of treeview expanded nodes. i.e. if any node is expanded, then
    on click of that node and after new page is loaded , treeview should come
    with the previous state i.e. nodes should come expanded if they were and
    collapsed if they were. How to do this as clciking on node and loading new
    page gives ispostback to false for the treeview container control?

    Vikram
     
    Vikram, Aug 22, 2007
    #1
    1. Advertising

  2. Vikram,

    Take a look at my blog. I have a pretty extensive discussion on your issue.

    http://blog.binaryocean.com/2006/01/19/SaveTreeViewNodesExpansionCollapseStateCSAndVB.aspx

    Hope this gets you going in the right direction.

    --

    Andrew Robinson
    http://blog.binaryocean.com
    http://www.bellinghamdotnet.org


    "Vikram" <> wrote in message
    news:...
    > Hi,
    > I am using a treeview control in a master page. On click of any node I am
    > opening new page and all pages are incorporated in master page. Now I want
    > to
    > maintain state of treeview expanded nodes. i.e. if any node is expanded,
    > then
    > on click of that node and after new page is loaded , treeview should come
    > with the previous state i.e. nodes should come expanded if they were and
    > collapsed if they were. How to do this as clciking on node and loading new
    > page gives ispostback to false for the treeview container control?
    >
    > Vikram
     
    Andrew Robinson, Aug 29, 2007
    #2
    1. Advertising

  3. Vikram

    ZZ_Scarab Guest

    Hi Andrew,

    I had the same problem and found your reply to be very informative. Thank
    you very much.

    I do have another related problem, though, and being new to C# and ASP.Net,
    I'm not sure if I'm missing something real basic.

    I implemented a solution based on your suggestion and it worked fine.
    However, I need to bind the treeview to a datasource. I'm for now trying a
    WebSiteMap file. As soon as I set the treeview's DataSourceId to a data
    source based on the file, the TreeViewMain_SelectedNodeChanged even stops
    firing. Setting a breakpoint on the line

    if (TreeViewMain.SelectedNode.Value != string.Empty)

    is never "hit". Is this a feature of the treeview control or am I missing
    something?

    Can you shed ome light on this please as it's really driving me nuts!

    Thanks



    "Andrew Robinson" wrote:

    > Vikram,
    >
    > Take a look at my blog. I have a pretty extensive discussion on your issue.
    >
    > http://blog.binaryocean.com/2006/01/19/SaveTreeViewNodesExpansionCollapseStateCSAndVB.aspx
    >
    > Hope this gets you going in the right direction.
    >
    > --
    >
    > Andrew Robinson
    > http://blog.binaryocean.com
    > http://www.bellinghamdotnet.org
    >
    >
    > "Vikram" <> wrote in message
    > news:...
    > > Hi,
    > > I am using a treeview control in a master page. On click of any node I am
    > > opening new page and all pages are incorporated in master page. Now I want
    > > to
    > > maintain state of treeview expanded nodes. i.e. if any node is expanded,
    > > then
    > > on click of that node and after new page is loaded , treeview should come
    > > with the previous state i.e. nodes should come expanded if they were and
    > > collapsed if they were. How to do this as clciking on node and loading new
    > > page gives ispostback to false for the treeview container control?
    > >
    > > Vikram

    >
    >
    >
     
    ZZ_Scarab, Sep 10, 2007
    #3
  4. Vikram

    ZZ_Scarab Guest

    Hi,

    More comment: I changed my data source from the Sitemap to programmatically
    populating the tree view from a database. The problem went away and the even
    is now firing. That was the only change, so I'm still not sure I understand
    why it was not firing before.

    --------------------------------------------------------------------------------

    "ZZ_Scarab" wrote:

    > Hi Andrew,
    >
    > I had the same problem and found your reply to be very informative. Thank
    > you very much.
    >
    > I do have another related problem, though, and being new to C# and ASP.Net,
    > I'm not sure if I'm missing something real basic.
    >
    > I implemented a solution based on your suggestion and it worked fine.
    > However, I need to bind the treeview to a datasource. I'm for now trying a
    > WebSiteMap file. As soon as I set the treeview's DataSourceId to a data
    > source based on the file, the TreeViewMain_SelectedNodeChanged even stops
    > firing. Setting a breakpoint on the line
    >
    > if (TreeViewMain.SelectedNode.Value != string.Empty)
    >
    > is never "hit". Is this a feature of the treeview control or am I missing
    > something?
    >
    > Can you shed ome light on this please as it's really driving me nuts!
    >
    > Thanks
    >
    >
    >
    > "Andrew Robinson" wrote:
    >
    > > Vikram,
    > >
    > > Take a look at my blog. I have a pretty extensive discussion on your issue.
    > >
    > > http://blog.binaryocean.com/2006/01/19/SaveTreeViewNodesExpansionCollapseStateCSAndVB.aspx
    > >
    > > Hope this gets you going in the right direction.
    > >
    > > --
    > >
    > > Andrew Robinson
    > > http://blog.binaryocean.com
    > > http://www.bellinghamdotnet.org
    > >
    > >
    > > "Vikram" <> wrote in message
    > > news:...
    > > > Hi,
    > > > I am using a treeview control in a master page. On click of any node I am
    > > > opening new page and all pages are incorporated in master page. Now I want
    > > > to
    > > > maintain state of treeview expanded nodes. i.e. if any node is expanded,
    > > > then
    > > > on click of that node and after new page is loaded , treeview should come
    > > > with the previous state i.e. nodes should come expanded if they were and
    > > > collapsed if they were. How to do this as clciking on node and loading new
    > > > page gives ispostback to false for the treeview container control?
    > > >
    > > > Vikram

    > >
    > >
    > >
     
    ZZ_Scarab, Sep 12, 2007
    #4
    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. Doug McCann
    Replies:
    1
    Views:
    1,134
    William Brogden
    Aug 5, 2004
  2. Nikron
    Replies:
    1
    Views:
    683
    Nikron
    Sep 28, 2007
  3. =?Utf-8?B?QnJpYW4=?=
    Replies:
    1
    Views:
    562
  4. Greg
    Replies:
    0
    Views:
    219
  5. Nikron
    Replies:
    1
    Views:
    146
    Nikron
    Sep 28, 2007
Loading...

Share This Page