0

Hi there,
what the best way to add a layout, simply to manage, to my web site asp.net?

Are masterpages the best solution?

Can i get some example of simple editable layout?

Thanks for you help

4
Contributors
4
Replies
32
Views
3 Years
Discussion Span
Last Post by harsh9
0

You definitely should consider using master pages for projects that have multiple pages that need to share a common layout. This allows you to manage one page for the overall layout.

You should also be using an external style sheet to manage the look and feel (colors, fonts, margins, etc..).

With asp.net controls, its easy to apply these styling properties at the controls but you find future changes to be hard to manage because you have to go back to each control and update the settings. For that reason, I never add any styling properties at the control level.

With regard to simple layout examples, visual studio comes with at least one example site, but you can really download any HTML website and use the layout to populate your master page and then go from there.

Check the asp.net official site as there are tutorials for the use if master pages.

0

Like JorgeM said, Master is the easiest to manage page layout instead of manage each of them.
You could download the HTML Markup code / view from those free HTML templates sources, then you just simply apply into your master page.

0

Master pages allow you to create a consistent look and behavior for all the pages (or group of pages) in your web application.

A master page provides a template for other pages, with shared layout and functionality. The master page defines placeholders for the content, which can be overridden by content pages. The output result is a combination of the master page and the content page.

The content pages contain the content you want to display.

When users request the content page, ASP.NET merges the pages to produce output that combines the layout of the master page with the content of the content page.

**Master Page Example**
<%@ Master %>

<html>
<body>
<h1>Standard Header From Masterpage</h1>
<asp:ContentPlaceHolder id="CPH1" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>

The master page above is a normal HTML page designed as a template for other pages.

The @ Master directive defines it as a master page.

The master page contains a placeholder tag <asp:ContentPlaceHolder> for individual content.

The id="CPH1" attribute identifies the placeholder, allowing many placeholders in the same master page.

This master page was saved with the name "master1.master".

**Content Page Example**
<%@ Page MasterPageFile="master1.master" %>

<asp:Content ContentPlaceHolderId="CPH1" runat="server">
  <h2>Individual Content</h2>
  <p>Paragraph 1</p>
  <p>Paragraph 2</p>
</asp:Content>

The content page above is one of the individual content pages of the web.

The @ Page directive defines it as a standard content page.

The content page contains a content tag <asp:Content> with a reference to the master page (ContentPlaceHolderId="CPH1").

This content page was saved with the name "mypage1.aspx".

When the user requests this page, ASP.NET merges the content page with the master page.

Regards,
Harsh

Edited by Dani: Formatting fixed

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.