Sunday, August 2, 2009

Hey, I am making a website using Master Page with visual studio, I created a perfect Master....?

with 4 contentPlaceHolders {Header, Footer, Categories %26amp; main}


now i want my website to work according to:


i want the header, footer %26amp; categories to never change when the client surfs my web


i want the contentPlaceHolder of the main only to change..how can i do that??


what steps do i make???


do i need c sharp coding or so???

Hey, I am making a website using Master Page with visual studio, I created a perfect Master....?
You need C# or Visual Basic for the behind code (ie the server side coding). If the code is not necessary to be done on the server side I suggest you don't as it slows down loading time.





So you have the master page - everything that you want to remain the same must be specified in the master page. Now you have to add a content page (there should be something like add -%26gt; content page).





This will automatically be created with the appropiate content place holders. You will only need to edit the page title (on the line of code) and the actual code inside the content place holder.
Reply:You do not actually need four contentPlaceHolders.





A placeHolder is an area to be filled by a content page.





In your case, you need a Master page with only ONE contentPlaceHolder.





Your master page will look something like this:





%26lt;html xmlns="http://www.w3.org/1999/xhtml"%26gt;


%26lt;head runat="server"%26gt;


%26lt;title%26gt;%26lt;/title%26gt;


media="screen" /%26gt;


%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;form id="form1" runat="server"%26gt;


%26lt;table border="0" cellspacing="0" cellpadding="0"%26gt;


%26lt;tr%26gt;


%26lt;td colspan="2"%26gt;%26lt;!-- header here --%26gt;%26lt;/td%26gt;


%26lt;/tr%26gt;


%26lt;tr%26gt;


%26lt;td%26gt;


%26lt;!-- Categories go here --%26gt;


%26lt;/td%26gt;


%26lt;td%26gt;


%26lt;asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"%26gt; %26lt;/asp:ContentPlaceHolder%26gt;


%26lt;/td%26gt;


%26lt;/tr%26gt;


%26lt;tr%26gt;


%26lt;td%26gt;%26lt;!-- footer goes here --%26gt;


%26lt;/tr%26gt;


%26lt;/table%26gt;


%26lt;/form%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;





Hope this helps.


No comments:

Post a Comment