1
votes

I am trying to help friend with his website which is written in asp.net. I am newbie in asp.net but I know php and mysql. Right know I am trying to figure out, how to declare which page (something.aspx) is shown in ContentPlaceHolder.

For example:

I have one master page (web.master) on which I have:

< asp:ContentPlaceHolder id="cpMainContent" runat="server">

Then I have many content pages (f.e. article.aspx, section.apsx) on which I have:

< asp:Content ID="Something" ContentPlaceHolderID="cpMainContent" runat="server">Some content

So my question is, how the website knows which .aspx file to open? If I open my friends website, I found out, that in cpMainContent is content from file section.aspx. If I make new page, like section2.aspx, how should I let the website know, that it should use the new created page?

Thank you very much for responses.

2
Content Pages are the pages user can access not master pages directly... So.... add a link to the page you want to direct to, its simple.... - Rusty
msdn.microsoft.com/en-us/library/wtxbf3hh%28v=vs.140%29.aspx the msdn article pretty explains almost everything, I suggest you read this - sertsedat

2 Answers

0
votes

When creating a new page, you give it a name and before you press "ADD" you can check off to "Select Master Page". It will bring up a dialog box of all master pages in the project and you can select one. Easy as that!

0
votes

Master pages are not accessed directly by the user. Redirection can be performed by adding the directory pathto the anchor tag to other pages( content pages associated with master pages/ not associated with master page ).