Unit-4 Working with Master page and Themes

Similar documents
5 Snowdonia. 94 Web Applications with C#.ASP

Practicum Guideline for ASP. Net with VB Handout 3 Making ASP website with the existing templates

CP3343 Computer Science Project (Year) Technical Report Document. Mr Stephen Garner

Websites WHAT YOU WILL LEARN IN THIS CHAPTER: WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

<asp:requiredfieldvalidator ID="RequiredFieldValidator2" runat="server"

Themes and Master Pages

Module 2: Using Master Pages

This tutorial starts by highlighting the benefits of nested master pages. It then shows how to create and use nested master pages.

ASP.NET Pearson Education, Inc. All rights reserved.

Final Web Application Create a new web site under c:\temp\webapps\ and name it Final. Create the following additional folders:

Chapter 6. Rich Page Composition... 1 Working with Master Pages... 2 Working with Themes Working with Wizards Conclusion...

8 Library loan system

CST272 Getting Started Page 1

Unit-3 State Management in ASP.NET

1 NEW FACE OF MICROSOFT VISUAL STUDIO 2005

HTML & CSS. Lesson 1: HTML Basics Lesson 2: Adding Tables Lesson 3: Intro to CSS Lesson 4: CSS in more detail Lesson 5: Review

Web Authoring and Design. Benjamin Kenwright

INTRANET. EXTRANET. PORTAL.

Master Pages :: Control ID Naming in Content Pages

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

TRAINING GUIDE. Rebranding Lucity Web

Micronet International College

CST272 Getting Started Page 1

Real World Branding with SharePoint Server 2007 Publishing

3 Customer records. Chapter 3: Customer records 57

Create a three column layout using CSS, divs and floating

This PDF was generated in real-time using DynamicPDF; Generator for.net.

Creating a Job Aid using HTML and CSS

E-Commerce: Theming your site Best practices and tips on theming E-Commerce Intermediate. Mike Poling & Erin Gannon

COMS 359: Interactive Media

CSS: formatting webpages

ASP.NET Security. 7/26/2017 EC512 Prof. Skinner 1

CSS Mapping in Advanced Mode for Events. Cvent, Inc 1765 Greensboro Station Place McLean, VA

NỘI DUNG 5.1 Xây dựng phần hiển thị sản phẩm Thiết kế layout cho trang web sử dụng MasterPage Xây dựng website đa ngôn ngữ...

Actual4Test. Actual4test - actual test exam dumps-pass for IT exams

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

Module 2 (VII): CSS [Part 4]

NAVIGATION INSTRUCTIONS

8 Basic Skinning. Introduction. In this chapter we will cover the following topics:

Arena: Edit External Web Templates (Course #A217)

Lab 9: Creating Personalizable applications using Web Parts

CS134 Web Site Design & Development. Quiz1

Basic CSS Lecture 17

What do we mean by layouts?

ComponentOne. Wizard for ASP.NET Web Forms

Quick Start Guide. This guide will help you get started with Kentico CMS for ASP.NET. It answers these questions:

This PDF was generated in real-time using DynamicPDF; Generator for.net.

Designing the Home Page and Creating Additional Pages

Tutorial 4. Activities. Code o Editor: Expression Web o Focus : Base Layout, navigation with folders, external stylesheets, Open up Expression Web

CSS stands for Cascading Style Sheets Styles define how to display HTML elements

Chapter 6: CSS Layouts

Caso de Estudio: Parte II. Diseño e implementación de. Integración de Sistemas. aplicaciones Web con.net

Creating Layouts Using CSS. Lesson 9

SharpShooter Reports.Web Getting Started (ASP.NET Web Application)

Web Recruitment Module Customisation

CSS means Cascading Style Sheets. It is used to style HTML documents.

Cascading Style Sheets Level 2

Getting Started with MadCap Flare Part 2: Feature Concepts

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

Introduction to Cascading Style Sheet (CSS)

Editing your SiteAssist Professional Template

Daniel Ferguson Certified MadCap Flare Trainer & Consultant Founder of Smart Output

Chapter 3 CSS for Layout

Overview. Part I: Portraying the Internet as a collection of online information systems HTML/XHTML & CSS

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

Wireframe :: tistory wireframe tistory.

Web Applications With Java Server Pages and Microsoft.NET Web Forms

CSS Cascading Style Sheets

Tutorial 2 Editor Brackets

GIMP WEB 2.0 MENUS. Before we begin this tutorial let s visually compare a standard navigation bar and a web 2.0 navigation bar.

ICT IGCSE Practical Revision Presentation Web Authoring

Styles, Style Sheets, the Box Model and Liquid Layout

Dynamic Select Option Menu Using Ajax And PHP. Wednesday, Mar 11, 2015

Snapsis CSS NavMenu Development Guide

Assignments (4) Assessment as per Schedule (2)

Validation Server Controls

Chapter 1 Introduction to Dreamweaver CS3 1. About Dreamweaver CS3 Interface...4. Creating New Webpages...10

Teacher s Reference Manual

Kentico CMS 5.0 Tutorial

Lesson 5 Introduction to Cascading Style Sheets

Before you begin, make sure you have the images for these exercises saved in the location where you intend to create the Nuklear Family Website.

Lab: Create JSP Home Page Using NetBeans

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

XML with.net: Introduction

Website Development (WEB) Lab Exercises

CSS Futures. Web Development

Flowtime Website Installation and Configuration Aug Product Version 8.1+

THE HITCHHIKERS GUIDE TO HTML

RAVASMARTSOLUTIONS - TECH TIPS

TEST NAME: MMWD 4.01 TEST ID: GRADE:09 - Ninth Grade Twelfth Grade SUBJECT:Computer and Information Sciences TEST CATEGORY: My Classroom

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

Lesson 1 HTML Basics. The Creative Computer Lab. creativecomputerlab.com

Diploma in Digital Applications Unit 5: Coding for the Web

Block & Inline Elements

Getting Started with CSS Sculptor 3

SASS Variables and Mixins Written by Margaret Rodgers. Variables. Contents. From Web Team. 1 Variables

In the early days of the Web, designers just had the original 91 HTML tags to work with.

Asp.Net Dynamic Form

Transcription:

MASTER PAGES Master pages allow you to create a consistent look and behavior for all the pages in web application. A master page provides a template for other pages, with shared layout and functionality. The master page defines placeholders for the content, which can be overridden by content pages. The output result is a combination of the master page and the content page. The content pages contain the content you want to display. When users request the content page, ASP.NET merges the pages to produce output that combines the layout of the master page with the content of the content page. Master page having.master extension. Define master page using @Master directive on top a web page. The Content of master pages is fixed for all derived pages. To place the changing data for every pages master page provide <ContentPlaceHolder> where each page hold its local content. Major characteristics of a master page: Defining common properties of a website, such as header, footer, banners, navigation menus and other elements that can be accessed by the content pages. Allowing single or multiple content pages to access single or multiple master pages. Displaying the content of each content page in content place holder. MasterPage.master <%@ Master Language="VB" CodeFile="MasterPageTest.master.vb" Inherits="MasterPageTest" %> <html> <head <title>untitled Page</title> <asp:contentplaceholder id="head" </asp:contentplaceholder> </head> 1 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

<body><form id="form1" <div><h1>standard Header From Masterpage</h1> <asp:contentplaceholder id="cph1" </asp:contentplaceholder> <div> <asp:button ID="btnContent2" runat="server" Text="Content-1" /> </form></body></html> MasterPage.master(Coding) Public Class MasterPage Inherits System.Web.UI.MasterPage Protected Sub btncontent2_click(byval sender As Object, ByVal e As EventArgs) Handles btncontent2.click Response.Redirect("Control.aspx") End Sub End Class Default.aspx <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile=" ContentPage.aspx.vb" Inherits=" ContentPage" title="untitled Page" %> <asp:content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <asp:content ID="Content2" ContentPlaceHolderID="CPH1" Runat="Server"> <h2>this is Home Page</h2> Control.aspx <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile=" ContentPage.aspx.vb" Inherits=" ContentPage" title="untitled Page" %> <asp:content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <asp:content ID="Content2" ContentPlaceHolderID="CPH1" Runat="Server"> <h2>this is Another Page</h2> NESTED MASTER PAGE * To demonstrate nesting master pages we will need to create two master pages, a main master page and a sub master page. Then, we will derive a content page from the sub master page to demonstrate how the pages all link together. Add MainMasterPage: Right click the project in your solution explorer. 2 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

Select add new item Select a master page. Name it MainMasterPage.master. Click add. The code for the MainMasterPage.master should look like this: <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="MainMaster.master.vb" Inherits="NestedMasterPageExample.MainMaster" %> <head <style type="text/css"> html background-color:silver; font:14px Georgia,Serif;.content width:700px; margin:auto; border-style:solid; background-color:white; padding:10px;.tabstrip padding:3px; border-top:solid 1px black; border-bottom:solid 1px black;.tabstrip a font:14px Arial; color:fuchsia; text-decoration:none;.column float:left; padding:10px; border-right:solid 1px black;.rightcolumn float:left; padding:10px;.footer background-color:lime; border:3px dotted red; 3 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

text-align:center;.clear clear:both; </style> <title>website Main Master Page</title> <asp:contentplaceholder ID="head" </asp:contentplaceholder> </head> <body> <form id="form1" <div class="content"> <asp:image id="imglogo" AlternateText="Logo" <div class="tabstrip"> <asp:hyperlink id="lnkproducts" Text="HOME" NavigateUrl="~/Column1_Con_Home.aspx" <asp:hyperlink id="lnkservices" Text="FORUM" NavigateUrl="~/Column2_Con_Home.aspx" <asp:contentplaceholder ID="ContentPlaceHolder1" </asp:contentplaceholder> <br class="clear" /> <div class="footer"> Copyright 2016 By DARSHAN INST. OF ENG. & TECH. FOR DIPLOMA STUDIES. </form> </body> </html> Add SubMasterPage: Right click the project in your solution explorer. Select add new item Select a Nested master page. Name it SubMasterPage.master. 4 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

Ensure that the Select nested master page option is checked. The SubMasterPage.master code should look like this: <%@ Master Language="VB" MasterPageFile="~/MainMaster.Master" AutoEventWireup="false" CodeBehind="Column1.master.vb" Inherits="NestedMasterPageExample.Column1" %> <asp:content ID="Content1" ContentPlaceHolderID="head" <asp:content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" <div class="column"> <asp:contentplaceholder id="contentplaceholder1" <div class="column"> <asp:contentplaceholder id="contentplaceholder2" <div class="rightcolumn"> <asp:contentplaceholder id="contentplaceholder3" Add SubMasterPage(2 nd ): Right click the project in your solution explorer. Select add new item Select a Nested master page. Name it SubMasterPage2.master. Ensure that the Select nested master page option is checked. The SubMasterPage2.master code should look like this: <%@ Master Language="VB" MasterPageFile="~/MainMaster.Master" AutoEventWireup="false" CodeBehind="Column2.master.vb" Inherits="NestedMasterPageExample.Column2" %> <asp:content ID="Content1" ContentPlaceHolderID="head" <asp:content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" <div class="column"> <asp:contentplaceholder id="contentplaceholder1" <div class="rightcolumn"> <asp:contentplaceholder id="contentplaceholder2" 5 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

Add WebPage: Right click the project in your solution explorer. Select add new item Select a web form. Name it Column1_Con_Home.aspx. Ensure that the Select master page (SubMasterPage.master) option is checked. Click add. The Column1_Con_Home.aspx code should look like this: <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Column1.master" CodeBehind="Column1_Con_Home.aspx.vb" Inherits="NestedMasterPageExample.Column1_Con_Home" %> <asp:content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" <asp:content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" <asp:content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" Column:3 Column:3 Column:3 Column:3 Column:3 6 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

Add WebPage: Right click the project in your solution explorer. Select add new item Select a web form. Name it Column2_Con_Home.aspx. Ensure that the Select master page (Column1.master) option is checked. Click add. Select Column2.master. Click ok. The Column2_Con_Home.aspx code should look like this: <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Column2.master" CodeBehind="Column2_Con_Home.aspx.vb" Inherits="NestedMasterPageExample.Column2_Con_Home" %> <asp:content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" <asp:content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Access master page controls from content page In ASP.NET need to access the master page controls from content page. Master page controls are not directly accessibly by content page. To access master page control we need to understand following: Master The Master property returns the MasterPage object associated with this page. FindControl(String) Searches server control with the specified id parameter. 7 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

MasterPage.master <asp:label ID="lblMasterLabel" runat="server" Text="Master Page Text"></asp:Label> ContentPage.aspx <asp:label ID="lblDisplay" runat="server" Text=""></asp:Label> ContentPage.aspx.vb Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim masterlbl As Label = Master.FindControl("lblMasterLabel") masterlbl.text = "This is Master Label" End Sub THEMES WITH SKIN FILE ** Theme Themes in Asp.Net enable you to define the style properties and the change the appearance of a Web Page. They provides User friendly interface with similar all over look with optimized code. You can set theme in master page directive in master page as well in web.config also. Theme can be defined as collection of element that is common look and feel for whole application. The Key Features are as follows: Providing flexibility to easily change the appearance of all web pages just by making changes in few template files with minimum possible efforts. Providing various options to customize a web page. E.g. in Orkut, you can change website appearance as per your requirement. Themes contain following elements: Skin It is having.skin extension that contains tags, property settings and formatting options for server side controls. Such as Label, TextBox and Button. Skin is divided into following two groups: Default: Default skin is applied automatically to all the controls of the same type in web page, when theme is applied to the page. SkinID attributes is used to determine whether the applied skin is default or not. If SkinID is not present in current tag means it is a default skin. Named: It is a customized skin that is applied to controls when theme is applied. It has SkinID property which allows different styles to different controls. 8 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

Applying existing theme to an application There are 3 different options to apply themes to our website: 1. Setting the theme at the page level: the Theme attribute is added to the page directive of the page. <%@ Page Language="VB" CodeFile="Default.aspx.cs"Inherits="Default" Theme="Theme1"%> 2. Setting the theme at the site level: to set the theme for the entire website you can set the theme in the web.config of the website. Open the web.config file and locate the <pages> element and add the theme attribute to it: <pages theme="theme1">... </pages> 3. Setting the theme programmatically at runtime: here the theme is set at runtime through coding. Page.Theme = Theme1; CSS Refers to a mechanism of adding fonts, colors, styles and behavior to web pages. CSS is used to provide the visual inheritance to all the web pages in the website. It is an Asp.Net file with.css extension and applies a style sheet as a part of theme in a web page. It should include in App_theme folder. Create CSS File & Theme Add Theme: Solution Explorer -> Right click -> Add ASP.NET folder -> Themes. A folder App_Themes is added to the Solution Explorer and a new folder Theme1 is added inside it. Theme1 -> Right click -> Add new item -> Skin File Skin1.skin Inside Skin1.skin <asp:label runat="server" width="300px" height="40px" font-bold="true" fontsize="x-large" forecolor="yellow" backcolor="green" SkinID= lbl /> <asp:textbox runat="server" font-bold="true" font-size="medium" forecolor="blue" backcolor="silver" font-italic="true" SkinID= txt /> <asp:button runat="server" forecolor="red" backcolor="yellow" SkinID= btn /> Create CSS Add Theme file: Solution Explorer -> Right click Add New Item Select StyleSheet Inside StyleSheet1.css p font-family:impact; text-align:center; 9 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura

color:green; Applying CSS to a webpage; Content.aspx <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Content.aspx.vb" Inherits="CSSExample.Content" %> <head <title></title> <Link rel="stylesheet" type="text/css" href="stylesheet1.css" /> </head> <body> <form id="form1" <div> <p> Hello My Name is ABCXYZ</p> <p> I am Student of Darshan Inst. of Eng. & Technology for Diploma Studies,Rajkot</p> <p> I am a Computer Engineer</p> </form></body> </html> 10 Dept: CE AWT (3360706) Prof. Akash N. Siddhpura