Master page and Theme ASP.NET with VB.NET

Preview:

DESCRIPTION

ASP.NET

Citation preview

MASTER PAGE

Shyam N. Chawda 07874391191

www.shyamsir.com

MASTER PAGE

.master

.aspx

Shyam N. Chawda 9374928879

MASTER PAGE

Shyam N. Chawda 9374928879

A page that defines the layout for a set of pages.

A master page can contain static text and controls that should appear on all pages.

Master pages are merged at run time with content pages that define page-specific content.

CONTENT PAGE

A Web page that is configured to be merged with a master page to create a complete page.

<%@ Page Language="VB" MasterPageFile="Master1.master" Title="Content Page" %>

Shyam N. Chawda 9374928879

Shyam N. Chawda 9374928879Shyam N. Chawda 9374928879

OUTPUT

Shyam N. Chawda 9374928879

ADVANTAGES

Centralize the common

Easy to create one set of controls and code and apply the results to a set of pages.

Shyam N. Chawda 9374928879

TITLEProblem

Shyam N. Chawda 9374928879

FROM CONTENT TO MASTERPAGE

Create masterpage

With label give it proper name.

Create .aspx page take one button

To refer master page u can write

Master.Page.Title = “abc”

FROM CONTENT TO MASTERPAGE

Change the master page’s control value

Dim txt As TextBox txt = Me.Master.FindControl("txtName") txt.Text = txtFname.Text

Shyam N. Chawda 9374928879

NESTED MASTER PAGE

Shyam N. Chawda 9374928879

NESTED MASTER PAGELarge site might contain an overall master page that defines the look of the site.

Example :

CollegeFacultyStudent

Shyam N. Chawda 9374928879

RUNTIME CHANGEPage_PreInit

Me.MasterPageFile = "MainMasterpage.master"

Shyam N. Chawda 9374928879

THEMEA theme is a collection of property settings that allow you to define the look of pages and controls.

Shyam N. Chawda 9374928879

THEME

Themes are made up of a set of elements:

SkinsCascading style sheets (CSS), images, and other resources.

At a minimum, a theme will contain skins.

Shyam N. Chawda 9374928879

SKIN FILE

A skin file has the file name extension .skin and contains property settings for individual controls such as Button, Label, TextBox, or Calendar controls.

Shyam N. Chawda 9374928879

HOW TO APPLY THEME?

<%@ Page Theme="ThemeName" %>

Shyam N. Chawda 9374928879

HOW TO APPLY THEME?

<configuration> <system.web>

<pages theme="ThemeName" />

</system.web> </configuration>

Shyam N. Chawda 9374928879

TYPES OF SKIN

A default skin automatically applies to all controls of the same type when a theme is applied to a page.

A named skin is a control skin with a SkinID property set.

Named skins do not automatically apply to controls by type.

Shyam N. Chawda 9374928879

Shyam N. Chawda 9374928879

PROPERTIES FOR THEME

EnableTheming

SkinId

Shyam N. Chawda 9374928879

CSS FILES

In the skin file, u can define only the styles associated with server controls.

What about HTML tags and HTML controls?

CSS

STEPS

Step 1:

Create App_theme folder

Step 2:

Add new CSS

Step 3:

Write down logic

Shyam N. Chawda 9374928879

STEPS

Step 4:Go to .aspx page

Step 5:Apply

<%@ Page StyleSheetTheme="ThemeName" %>

Shyam N. Chawda 9374928879

HOW TO APPLY CSS?

<configuration> <system.web> <pages StyleSheetTheme="Themename" /> </system.web> </configuration>

<%@ Page StyleSheetTheme="ThemeName" %>

RUNTIME

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit

Page.Theme = Request.QueryString("th")

End Sub

THEME

Types of Theme:

PageGlobal

Page for single page , individual for all the pages

Global applied to all the websites on a web server.

Shyam N. Chawda 9374928879

Shyam N. Chawda 07874391191

Thanks

www.shyamsir.com

Recommended