27
MASTER PAGE Shyam N. Chawda 07874391191 www.shyamsir.com

Master page and Theme ASP.NET with VB.NET

Embed Size (px)

DESCRIPTION

ASP.NET

Citation preview

Page 1: Master page and Theme ASP.NET with VB.NET

MASTER PAGE

Shyam N. Chawda 07874391191

www.shyamsir.com

Page 2: Master page and Theme ASP.NET with VB.NET

MASTER PAGE

.master

.aspx

Shyam N. Chawda 9374928879

Page 3: Master page and Theme ASP.NET with VB.NET

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.

Page 4: Master page and Theme ASP.NET with VB.NET

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

Page 5: Master page and Theme ASP.NET with VB.NET

Shyam N. Chawda 9374928879Shyam N. Chawda 9374928879

Page 6: Master page and Theme ASP.NET with VB.NET

OUTPUT

Shyam N. Chawda 9374928879

Page 7: Master page and Theme ASP.NET with VB.NET

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

Page 8: Master page and Theme ASP.NET with VB.NET

TITLEProblem

Page 9: Master page and Theme ASP.NET with VB.NET

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”

Page 10: Master page and Theme ASP.NET with VB.NET

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

Page 11: Master page and Theme ASP.NET with VB.NET

NESTED MASTER PAGE

Shyam N. Chawda 9374928879

Page 12: Master page and Theme ASP.NET with VB.NET

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

Example :

CollegeFacultyStudent

Shyam N. Chawda 9374928879

Page 13: Master page and Theme ASP.NET with VB.NET

RUNTIME CHANGEPage_PreInit

Me.MasterPageFile = "MainMasterpage.master"

Shyam N. Chawda 9374928879

Page 14: Master page and Theme ASP.NET with VB.NET

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

Shyam N. Chawda 9374928879

Page 15: Master page and Theme ASP.NET with VB.NET

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

Page 16: Master page and Theme ASP.NET with VB.NET

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

Page 17: Master page and Theme ASP.NET with VB.NET

HOW TO APPLY THEME?

<%@ Page Theme="ThemeName" %>

Shyam N. Chawda 9374928879

Page 18: Master page and Theme ASP.NET with VB.NET

HOW TO APPLY THEME?

<configuration> <system.web>

<pages theme="ThemeName" />

</system.web> </configuration>

Shyam N. Chawda 9374928879

Page 19: Master page and Theme ASP.NET with VB.NET

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

Page 20: Master page and Theme ASP.NET with VB.NET

Shyam N. Chawda 9374928879

PROPERTIES FOR THEME

EnableTheming

SkinId

Page 21: Master page and Theme ASP.NET with VB.NET

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

Page 22: Master page and Theme ASP.NET with VB.NET

STEPS

Step 1:

Create App_theme folder

Step 2:

Add new CSS

Step 3:

Write down logic

Shyam N. Chawda 9374928879

Page 23: Master page and Theme ASP.NET with VB.NET

STEPS

Step 4:Go to .aspx page

Step 5:Apply

<%@ Page StyleSheetTheme="ThemeName" %>

Shyam N. Chawda 9374928879

Page 24: Master page and Theme ASP.NET with VB.NET

HOW TO APPLY CSS?

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

<%@ Page StyleSheetTheme="ThemeName" %>

Page 25: Master page and Theme ASP.NET with VB.NET

RUNTIME

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

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

End Sub

Page 26: Master page and Theme ASP.NET with VB.NET

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

Page 27: Master page and Theme ASP.NET with VB.NET

Shyam N. Chawda 07874391191

Thanks

www.shyamsir.com