This tutorial is for creating a basic ASP.NET website with usage of masterpage and stylesheets.
-> Download and install Visual Studio 2008
-> Choose from the menu File>New>Website
-> Choose ASP.NET Web Site, click OK
-> Go to solution Exporer in the right pane, right click on your project name, click "Add New Item". Choose "Master Page" in the upcoming panel. Click ok.
MasterPages are for defining a consistent layout for every page that uses the masterpage. Say you want a logo and a title on every page in your website. Masterpages work for you in two ways:
--Code Reuse: Instead of adding it in every page, you add the logo and title once to the masterpage and just use masterpage on every page
--Maintainability: When you need to change the logo, you will not need to change every page one by one, you will only change the masterpage and you're done.
-->Find a logo image file, rename it "logo.jpg". Drag and drop it to your project's name in the right panel. It is now a part of your project.
--> Open your masterpage file (MasterPage.Master) Find the html tags. In between the lines that starts with "
"
it will look like this:
"
-->Now go to your Default.aspx file. First line will look like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Replace it with
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeFile="Default.aspx.cs" Inherits="_Default" %>
No comments:
Post a Comment