Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir,

I am new in ASP.net.
In my master page I have designed left menu,
when I clicked one of menu then it slide down to show its sub menu.
after clicking on its sub menu respective page will be loaded into "ContentPlaceHolder", but master page's menu will not be active.

What should i do for loading another webpage in ContentPlaceHolder and simultaneously master page's clicked(selected) menu item should be active?

Please help me.

Thank you.
Posted
Comments
F-ES Sitecore 31-Jul-15 6:37am    
As already mentioned, master pages aren't "frames" or any form of componentised framework, they are simply templates that knit together to form a single page. You need to make sure your menu code understands how it is supposed to render itself based on the current url (or based on a property of the content page if you want to do it like that).

Master page is not a wrapper like an iFrame is. It is a template for the page that loads. By this logic you cannot load the content "into" the content place holder without loading the whole page.

You can ensure that menu items remain selected in various ways on page_load or you can load different content in other ways.

Look into view state persistence to keep items selected in a control when the page changes: Efficient Server-Side View State Persistence[^].

Also, Update panels can be use to perform "partial" postbacks. it actually posts the whole page but only returns an ajax representation of the update panel which is then loaded into the update panel at the client side: Ajax update panel- best practice 1[^]. This is handy for forms that update on-the-fly but you shouldn't base a whole website on them.

I hope that helps. Please let me know if you need any further guidance on any particular implementation, but in most cases, posting a new question is better

Good luck ^_^

Andy
 
Share this answer
 
To complete Andy's answer, you have some other choices:
- if you are using MVC, you could also use AjaxHelper combined with partial views.
https://msdn.microsoft.com/en-us/library/system.web.mvc.ajax.ajaxextensions.beginform(v=vs.118).aspx#M:System.Web.Mvc.Ajax.AjaxExtensions.BeginForm(System.Web.Mvc.AjaxHelper,System.Web.Mvc.Ajax.AjaxOptions)[^]
- going toward single page application design.one of the easiest way would be to utilize knockout http://learn.knockoutjs.com/[^]

- and the easiest way is to just use iframe (although I am not fan of this solution, I have seen it used in many places, specially older websites)!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900