Reputation: 728
I have a master page with one contentplaceholder and the rest of the master page is filled with user control file to define header, navigation etc. I have a side navigation that implements treeview. The treenode is populated with data from database. I want to use the contentplaceholder to show content from different .aspx
page according to the treenode clicked.
This is a part of master page:
<div>
<div>
<uc5:lcont ID="lcont1" runat="server"/>
</div>
<div>
<asp:ContentPlaceHolder ID="ccont" runat="server">
</asp:ContentPlaceHolder>
</div>
<div>
<uc7:rcont ID="rcont1" runat="server" />
</div>
As you can see the the contentplaceholder is centrally located between two divs. Let me show you the snapshot of it.
I want to load content from different .aspx
page to the contentplaceholder denoted by the yellow area. The content needs to be according to the treenode clicked on the right of it.
What I need is to replace the content inside the contentplace holder by another content within the same page without reloading the whole page.
Upvotes: 0
Views: 4701
Reputation: 3681
What you want here is what exactly the ASP.NET master and content page concept provides. You create a master page, in which you disgn the common layout of the web site. The header, footer, menu etc. The varaible content rendering is delegated to individual content pages, using one or many contentplaceholders in master page.
So now you need to create one or many content pages(.aspx) using "Web form Using Master Page" option in Visual studio. As soon as you create a content page, you get as many content blocks as you have content placeholders in master page. You need to just render these content blocks, then they will automatically displayed in the respective postion of the master page.
In your treeview, you need to make sure that the tree nodes link to these aspx pages properly. Then as soon as the tree node is clicked, the content will be rendered in the center area as desired.
Upvotes: 1