Avoid MasterPage to refresh

T

Tor Inge Rislaa

I have a MasterPage containing a TreeView menu. When clicking a menu item, a
page is loaded into the ContentPlaceHolder. It seems like both the
MasterPage and the page in the ContentPlaceHolder is refreshed when clicking
the menu item. That might be how it is supposed to be, but the problem is
that the menu in the masterpage returns to it's origin state where all the
nodes are collapsed. Is there a way to avoid this from happening?



TIRislaa
 
G

Guest

Be sure to only refresh/databind the treeview if "not IsPostback"
and
Enable ViewState on the treeview.

Hope this helps
 
T

Tor Inge Rislaa

Thank you


Brad Roberts said:
Be sure to only refresh/databind the treeview if "not IsPostback"
and
Enable ViewState on the treeview.

Hope this helps
 
M

Mark Rae

I have a MasterPage containing a TreeView menu. When clicking a menu item,
a page is loaded into the ContentPlaceHolder. It seems like both the
MasterPage and the page in the ContentPlaceHolder is refreshed when
clicking the menu item. That might be how it is supposed to be, but the
problem is that the menu in the masterpage returns to it's origin state
where all the nodes are collapsed. Is there a way to avoid this from
happening?

Brad has already answered your question, but it's important to understand
what MasterPages are or, more importantly, what they're not...

The biggest mistake people make concerning MasterPages is to imagine that
they're somehow the clever ASP.NET equivalent of framesets...

Judging by your phrase "When clicking a menu item, a page is loaded into the
ContentPlaceHolder", I have a feeling that you may be falling into this
trap...

I can assure that when you click on a menu item, a page is absolutely not
loaded into the ContentPlaceHolder - precisely the opposite!

When you click on a menu item which redirects to another page, the entire
page is rendered from the beginning. If the page in question happens to be a
content page, then its MasterPage will be used to provide the "top and tail"
of the eventual HTML which is streamed down to the client browser...

A MasterPage isn't actually a page at all - it's just a special kind of
UserControl.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top