Exforsys

ASP.NET 2.0

  1. Getting started with ASP.NET 2.0
  2. .NET Framework Fundamentals
  3. Microsoft.NET Framework Tools
  4. Application Development in .NET
  5. What's New in the .NET Framework 2.0 ?
  6. Introduction to Visual Studio.NET
  7. Installing Visual Studio.NET 2005
  8. Working with Visual Studio.NET Web Applications
  9. Whats New in ASP.NET 2.0
  10. Creating an ASP.NET Application
  11. ASP.NET Code Directory
  12. ASP.NET Page Object Model
  13. ASP.NET Server Controls
  14. ASP.NET Working With Master Pages
  15. ASP.NET Creating Content for Master Page
  16. ASP.NET Referencing Master Page Members
  17. ASP.NET Changing Master Pages Dynamically
  18. ASP.NET Creating Nested Master Pages
  19. ASP.NET Working with Web Parts
  20. ASP.NET Using Web Parts and Controls in Web Pages
  21. ASP.NET Web Pages and Layout
  22. ASP.NET - Adding Web Parts at Run Time
  23. ASP.NET Personalization: User Profiles and Themes
  24. ASP.NET Data Access features
  25. ASP.NET State Management
  26. ASP.NET Customizing the Session State Mechanism
  27. ASP.NET State Management And Caching
  28. ASP.NET Security
  29. Forms Authentication in ASP.NET
  30. ASP.NET Managing Membership and Roles
  31. ASP.NET Configuring Page-Level Caching
  32. ASP.NET Setting Application-Level Caching
  33. ASP.NET Data Source Object Model
  34. ASP.NET SqlDataSource Control
  35. ASP.NET Data Bound Controls
  36. ASP.NET GridView Control
  37. ASP.NET GridView Filtering
  38. ASP.NET Adding Sorting and Paging in GridView
  39. ASP.NET DataBound Controls - Details View
  40. ASP.NET Using a Grid to Display Detail Information
  41. ASP.NET Displaying Master-Detail Data on the Same Page
  42. Displaying Master-Detail Data on Separate Pages in ASP.NET
  43. ASP.NET Creating Web Wizards
  44. ASP.NET : Dynamic Image control
  45. ASP.NET Advanced Site Functionality

Ads


Home arrow Technical Training arrow ASP.NET 2.0

ASP.NET Working With Master Pages

Page 1 of 3
Author : Exforsys Inc.     Published on: 17th Aug 2005    |   Last Updated on: 20th Feb 2011

ASP.NET Working With Master Pages

In this Tutorial you will learn how to work with Master Pages, create a file system on website, create a Master Page, create layout table for the Master Page, To add static content to the master page and add a content placeholder.

Ads

Creating a Simple Master Page

As pointed out in the preceding section “Working with Master Pages”, Master pages can be simple or complex. We shall start by creating a simple master page and then go on to understanding the complexities that can be interwoven.

A master page can be created using the Windows Notepad or the Microsoft Visual Web Developer which gives full designer support for building master pages.

We shall now create a simple master page titled Simple Master Page. This page will contain a HTML table with one ContentPlaceHolder control.

To create a file system Web site

1. Open Visual Studio Developer environment
2. On the File menu, click NewWeb Site.

The New Web Site dialog box appears.

3. Under Visual Studio installed templates, click ASP.NET Web Site.
4. In the Location box, enter the name of the folder where you want to keep the pages of your Web site. Here we are creating a File system folder so we do not change the contents of the combo box.
5. In the Language list, click the programming language you prefer to work in. We propose to work with C sharp. So we select that.
6. Click OK.

Visual Web Developer creates the folder and a new page named Default.aspx.

Creating the master page

1. In Solution Explorer, right-click the name of your Web site, and then click AddNew Item.

2. Under Visual Studio installed templates, click Master Page.

3. In the Name box, type MasterPage.
4. Select the Place code in separate file box.
5. In the Language box, click the programming language you prefer and then click Add.

The new master page opens in Source view.

At the top of the page, the page includes a < %@ master % > declaration instead of the < %@ page % > declaration normally found at the top of ASP.NET pages. The body of the page contains an < asp:contentplaceholder > control, which is the area of the master page where replaceable content will be merged from content pages at run time.

Ads

This master page is now the template for the pages in the web site. It can contain combinations of text and controls. It can also contain one or more ContentPlaceHolders which will determine where dynamic content will appear.

We will now position a table to help place the elements on the page. We will start by creating a layout table to hold the master elements and later we will position the ContentPlaceHolder control in an appropriate place.



 
This tutorial is part of a ASP.NET 2.0 tutorial series. Read it from the beginning and learn yourself.

ASP.NET 2.0

  1. Getting started with ASP.NET 2.0
  2. .NET Framework Fundamentals
  3. Microsoft.NET Framework Tools
  4. Application Development in .NET
  5. What's New in the .NET Framework 2.0 ?
  6. Introduction to Visual Studio.NET
  7. Installing Visual Studio.NET 2005
  8. Working with Visual Studio.NET Web Applications
  9. Whats New in ASP.NET 2.0
  10. Creating an ASP.NET Application
  11. ASP.NET Code Directory
  12. ASP.NET Page Object Model
  13. ASP.NET Server Controls
  14. ASP.NET Working With Master Pages
  15. ASP.NET Creating Content for Master Page
  16. ASP.NET Referencing Master Page Members
  17. ASP.NET Changing Master Pages Dynamically
  18. ASP.NET Creating Nested Master Pages
  19. ASP.NET Working with Web Parts
  20. ASP.NET Using Web Parts and Controls in Web Pages
  21. ASP.NET Web Pages and Layout
  22. ASP.NET - Adding Web Parts at Run Time
  23. ASP.NET Personalization: User Profiles and Themes
  24. ASP.NET Data Access features
  25. ASP.NET State Management
  26. ASP.NET Customizing the Session State Mechanism
  27. ASP.NET State Management And Caching
  28. ASP.NET Security
  29. Forms Authentication in ASP.NET
  30. ASP.NET Managing Membership and Roles
  31. ASP.NET Configuring Page-Level Caching
  32. ASP.NET Setting Application-Level Caching
  33. ASP.NET Data Source Object Model
  34. ASP.NET SqlDataSource Control
  35. ASP.NET Data Bound Controls
  36. ASP.NET GridView Control
  37. ASP.NET GridView Filtering
  38. ASP.NET Adding Sorting and Paging in GridView
  39. ASP.NET DataBound Controls - Details View
  40. ASP.NET Using a Grid to Display Detail Information
  41. ASP.NET Displaying Master-Detail Data on the Same Page
  42. Displaying Master-Detail Data on Separate Pages in ASP.NET
  43. ASP.NET Creating Web Wizards
  44. ASP.NET : Dynamic Image control
  45. ASP.NET Advanced Site Functionality
 

Comments