0

Can an experienced MS Visual Web Developer please give some guidance(links welcome as well) on how best to set out content sections in masterpages.

The microsoft documentation shows (here)creating masterpages using tables. However it is my understanding that the use of tables is not really good practise, somewhat frowned upon.

I have got a masterpage but on my subsequent derived pages I am struggling to get content on to the content area without using a table in the code.

I know this is very basic but it isn't defined very well and I am more used to the direct drag and drop of windows forms.

sayth
  • 6,696
  • 12
  • 58
  • 100
  • 1
    You will need to familiarize yourself with 'div-based' layouts. Here's a good place to start: http://csszengarden.com/ – Kevin Boucher Oct 08 '12 at 21:33
  • 1
    You can use tables, or you can use CSS with a combination of margins and floating. It depends on how you intend to layout the elements. How do you intend to lay it out? Btw, I would read [the answer to this post](http://stackoverflow.com/questions/83073/why-not-use-tables-for-layout-in-html) which may give you a little more insight with regard to using table vs. div (for example). – Jeremy Oct 08 '12 at 21:40
  • Also found this good resource for CSS http://css.maxdesign.com.au/ – sayth Oct 12 '12 at 01:53

2 Answers2

2

You might want to check this tutorial out: http://www.asp.net/web-forms/tutorials/master-pages/creating-a-site-wide-layout-using-master-pages-cs.

They don't use a table element, but div elements & some css.

kdrvn
  • 1,009
  • 1
  • 7
  • 10
  • Thanks for the answer I think the mistake I was making was trying to use the toolbox to get the result when as the tutorial shows its much easier to write it by hand. – sayth Oct 09 '12 at 04:03
1

I think this has more to do with web design skills than being expert in Visual Studio master page. MasterPage only allows you define regions to put stuffs, the design is up to you, tables or div.

You can even get well designed templates from the web, paste the markup in your MasterPage file and fill in the ContentPlaceHolder tags where you want stuffs to be e.g. SideBar, Navigation Menu, MainContent, Footer, etc.

<div id="header">
  some header content here
</div>

<div id="layout">

   <div id="leftsidebar"></div>

   <div id="maincontent">
      <!-- Content Pages will go here -->
      <asp:ContentPlaceHolder runat="server" ID="MainContent">
      </asp:ContentPlaceHolder>
   </div>

</div>

<div id="footer">
   some footer content here
</div>

That's just a sample. It can be more beautiful, complex, slick etc. than that. It depends on your skill as a web designer

codingbiz
  • 26,179
  • 8
  • 59
  • 96