The easiest & quickest way to get on with Master Pages
Creating a Master Page :
- Create an aspx page, as you want the basic layout to be.
- Add a new Master Page to your web app.
- Copy all code from aspx page created in step 1, exclude @Page tag
- Paste everything by replacing default code in MasterPage, keep @Page tag as it is
- Wherever you want content to appear from content pages, place a <asp:contentplaceholder> control
- Master page is ready now
The above method helps in previewing changes easily, though a master page can be created directly without using an aspx page first, and can be previewed using a content page.
Using a Master Page :
- Add a WebContentForm to web app.
- Select the master page for this page. That's it!
if its a web project, you will have to select WebForm and check 'select master page' check box while adding this page.
If a page already exist and you want to convert it to a content page, add "MasterPageFile" attribute in @Page directive of the wannabe content page and remove all html code from this page and pace <asp:content> control and the code you want to appear in content area.
No comments:
Post a Comment