Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation www.telerik.com.

Slides:



Advertisements
Similar presentations
Malek Kemmou Technology Architect, Application Platform Microsoft Middle East and Africa Overview of ASP.NET 2.0.
Advertisements

EIONET Training Zope Page Templates Miruna Bădescu Finsiel Romania Copenhagen, 28 October 2003.
HTML Basics Customizing your site using the basics of HTML.
IT533 Lectures Validation Controls, User Controls, Master Pages.
Website Design.
Internetteknologi (ITNET2) Presentation 21: ASP.NET Advanced.
Web Forms and ASP.NET Programming Right from the Start with Visual Basic.NET 1/e 12.
User Controls, Master Pages, GridView. Content User Controls Styles, Themes, Master Pages Working with Data GridView Muzaffer DOĞAN - Anadolu University2.
Unit 5: Building Presentation Layer Applications with ASP.NET 2.0.
AJAX & By – Anupama Sharma. Defining Ajax Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together.
Navigation Controls MacDonald Ch. 11 MIS 424 MIS 424 Professor Sandvig Professor Sandvig.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Best Practices for UI with ASP.NET 2.0 Jeff King Program Manager Web Platform and Tools Microsoft Corporation.
CPSC 203 Introduction to Computers Lab 39, 40 By Jie (Jeff) Gao.
1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources.
 Using Microsoft Expression Web you can: › Create Web pages and Web sites › Set what you site will look like as you design it › Add text, images, multimedia.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Java Beans.
Ch6:creating consistent looking web sites. Master pages Master page defines a combination of fixed content and content place holder to hold the web page(.aspx)
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 4-1 of…
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Web User Controls This presentation will cover the basics of defining, creating and using a web user control. Presented to Twin Cities.NET user group By.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Designer Basics.
PAGE DIRECTIVES. Page Directives  They are instructions, inserted at the top of an ASP.NET page, to control the behavior of ASP.NET pages.  So it is.
Christopher M. Pascucci.NET Programming CodeBehind.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Module 8: Creating User Controls. Overview Adding User Controls to an ASP.NET Web Form Creating User Controls.
Tutorial 3 Adding and Formatting Text with CSS Styles.
1 Working with ASP.NET Master Pages By huda AlSuwailem Reference: Mastering Microsoft Visual Web Developer 2005 Express Edition by John Paul Mueller.
Microsoft ® Official Course Developing a Publishing Site for Web Content Microsoft SharePoint 2013 SharePoint Practice.
Adxstudio Portals Training
1 CS 3870/CS 5870: Note 18 SiteMap Prog8. Test 2 50 Points Thursday, Nov 12 2:00 PM – 4:00 PM Lab
Modern Design Principles (MS). Hubs & spoke navigation pattern Hierarchical pattern Best for large collections of related content Content is separated.
ASP.NET User Controls. User Controls In addition to using Web server controls in your ASP.NET Web pages, you can create your own custom, reusable controls.
Adxstudio Portals Training
ASP.NET Rehab AlFallaj. Manualy type the following code for iframe tag in the aspx source code.
Marco Bellinaso Senior Trainer & Consultant Code Architects Srl Building Dynamic Navigation Systems with Visual Studio 2005 and ASP.NET 2.0.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
1111 Master Pages Beginning ASP.NET in C# and VB Chapter 6.
Module 10: Data Access in ASP.NET. Overview Overview of the ASP.NET Data Access What is Data Access List of Data Source Control What is Data Bound How.
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
Easy Site Navigation Getting organized, staying organized Creating custom site-navigation controls Using Menu, TreeView, and SiteMenuPath controls Make.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Developer Exam Preparation Thom Robbins Bryan Soltis
Visual Programming Borland Delphi. Developing Applications Borland Delphi is an object-oriented, visual programming environment to develop 32-bit applications.
Making the Most of Search in SharePoint 2013 Christina Wheeler.
Creating Consistent Looking Websites
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Section 10.1 Define scripting
DHTML.
Site Maps and Navigation
ASP.NET Forms.
Working in the Forms Developer Environment
Using ASP.NET Master Pages
Website Navigation.
State management & Master Pages in asp.net
CS 3870/CS 5870 Prog 6 Site Map.
Building ASP.NET Applications
Web Development Using ASP .NET
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
NAVIGATION CONTROLS.
Website Navigation.
Presentation transcript:

Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation

1. Master Pages 2. User Controls 3. Navigation Controls 4. Localization

Header Navigation Content Footer

 The structure of the site is repeated over most of its pages  Common Look & Feel  To avoid the repeating (and copying) of HTML code and the logics behind it

 Provide reusable user interface  Allow creating a consistent layout for the pages in your application  Can be set either at the design or programmatically

 Master Pages start with directive  Almost the same attributes as directive  Master Pages can contain:  Markup for the page (,, …)  Standard contents (HTML, ASP.NET controls)  controls which can be replaced in the Content Pages

 Content Pages derive the entire content and logic from their master page  Use directive with MasterPageFile attribute pointing to the Master Page  Replace a from the master page by using the control  Set the ContentPlaceHolderID property  Points to the ContentPlaceHolder from the Master Page which content we want to replace

Site.masterSite.master Default.aspx (content page) Page MasterPageFile= "~/Site.master" %> "~/Site.master" %> <asp:Content ContentPlaceHolderID ContentPlaceHolderID "MainContent"> "MainContent"> Here we put the contents Here we put the contents with which we want to with which we want to replace the default ones replace the default ones</asp:content><asp:ContentPlaceHolder ID="MainContent"> ID="MainContent"> Here we put the Here we put the default content default content</asp:ContentPlaceHolder> Footer Header Navigation

Live Demo

 We can change the Master Page at runtime in the code-behind  We can also select the Master Page according to the browser type Page.MasterPageFile = "~/SiteLayout.master"; Page Language="C#" ie:MasterPageFile="~/IESiteLayout.master" ie:MasterPageFile="~/IESiteLayout.master" mozilla:MasterPageFile="~/FFSiteLayout.master" %> mozilla:MasterPageFile="~/FFSiteLayout.master" %>

 Master pages can be nested, with one master page referencing another as its master  Nested Master Pages allow creating componentized Master Pages  A child master page has the file name extension.master, as any master page // Parent Master Page // Parent Master Page <asp:Content ID="Menu" ContentPlaceholderID="MainContent" runat="server"> runat="server"> // Child Master Page // Child Master Page

 User controls are reusable UI components used in ASP.NET Web Forms applications  User controls derive from TemplateControl  Similar to a Web form  Have HTML and CodeBehind  Allow developers to create their own controls with own UI and custom behavior

 To add a User Control

User Controls (3)  A Web User Control:  An ASP.NET page that can be nested in another ASP.NET page  A server component which offers a user interface and attached logics  Can be shared by the pages of an application  Cannot be viewed directly in a browser  Has a code-behind class

User Controls (4)  Differs from custom server controls  Custom controls are advanced and beyond the scope of the course  Consists of HTML and code  Doesn’t contain, and HTML tags  instead

User Controls – Advantages  Independent  Use separate namespaces for the variables  Avoid name collisions with the names of methods and properties of the page  Reusable  User controls can be used more than once on a single page  No conflicts with properties and methods  Language neutrality  User controls can be written in a language different of the one used in the page

Sharing of User Controls  User controls can be used throughout an application  Cannot be shared between two Web applications  Except by the copy&paste "approach"  Except by the copy&paste "approach"  Another approach is to create a Web custom control  Everything is manually written

Using User Controls  A user control can be added to each ASP.NET Web form  The form is called "host"  The form adds the control by using directive  TagName defines the name used by tags that will insert an instance of the control  Src is the path to the user control Register TagPrefix="demo" TagName="SomeName" Src="NumberBox.ascx"%> Src="NumberBox.ascx"%>

Live Demo

 Site maps and navigation controls provide an easy way to create navigation in ASP.NET  Site Map  Describes the logical structure of a site  Built in support for XML Site Map  Object model  Programming API for accessing the Site Map  SiteMapDataSource  Used for data binding

 Site Map – a way to describe and store the logical structure of the site  A tree-like data structure  Visual Studio supports Site Maps stored in XML files  To use another storage mechanism you must use a custom SiteMapProvider

 Create an XML file named Web.sitemap in the application root  Automatically detected by the default ASP.NET SiteMapProvider  Add a siteMapNode element for each page in your Web site  Nest siteMapNode elements to create a hierarchy  Should have only one root siteMapNode element

<siteMap> <siteMapNode title="Home" description="Home" <siteMapNode title="Home" description="Home" url="~/Default.aspx" /> url="~/Default.aspx" /> <siteMapNode title="Products" description= <siteMapNode title="Products" description= "Our products" url="~/Products.aspx"> "Our products" url="~/Products.aspx"> <siteMapNode title="Hardware" description= <siteMapNode title="Hardware" description= "Hardwarechoices" url="~/Hardware.aspx" /> "Hardwarechoices" url="~/Hardware.aspx" /> <siteMapNode title="Software" description= <siteMapNode title="Software" description= "Software choices" url="~/Software.aspx" /> "Software choices" url="~/Software.aspx" /> …</siteMap>

 Title – a friendly name of the node (page)  Description – used as a tool tip description in Site Map controls  URL – the URL of the page  Usually starting with " ~/ " meaning the application root

 Site Map Controls  Menu  TreeView  SiteMapPath

Site Navigation (3)

 The is a fully functional menu  We can change every visual aspect of the control  Images, effects, direction…  Two modes  Static – all of the menu nodes are visible  Dynamic – the menu nodes are visible only when the mouse pointer is over some of the MenuItem -s

 StaticDisplayLevels  The number of statically displayed levels starting from the root  MaximumDynamicDisplay  The number of dynamically displayed levels after the last of the static ones  Element onclick() event  Navigation to another page  Postback to the same page

TreeView control  TreeView is a control used to display data in a hierarchical view  Supports settings for various images and visual adjustments  Supports navigation and postback  We can create nodes at design time or through code  We can fill the nodes on demand (when there is lots of data)  Used together with SiteMapDataSource

 Allows the user to see where he is in the site hierarchy  Displayed in a straightforward fashion  We can set:  PathDirection – RootToCurrent and CurrentToRoot  PathSeparator – a separator between the levels in the hierarchy  ParentLevelsDisplayed – how many parent elements to display

SiteMapDataSource  SiteMapPath has integrated support for Site Map  When displaying Site Map information in any of them you a SiteMapDataSource object is used  First drop one on the page  Set the DataSourceID property of the bound control to point to the SiteMapDataSource

Live Demo

 Localization means to display the Web site in a different way when a different culture is used  ASP.NET supports localization through resource files  They have a.resx extension  Can be edited with Visual Studio  Two ways of localization  Implicit  Explicit

 Resource files are a collection of name-value pairs  We can edit them through Visual Studio  Create a separate file for each culture you want supported  Each resource file should include the locale in its name before the.resx  ASP.NET automatically picks the resource file corresponding to the UI culture of the user

 Implicit localization uses a set of resource files for each page  Each file name should be:  The name of the page +.localecode +.resx  Example: Default.aspx.bg-bg.resx  The names in the resource file correspond to the properties of controls on the page  Example: LabelPrice.Text

 Implicit localization automatically sets the properties of controls on the page that are present in the resource file  The values are the settings for that property we want applied  We can create a resource file for ASP.NET page using [Tools]  [Generate Local Resource]  After that we copy and rename the file for each culture and change its values <asp:Label runat="server" ID="lblHelloWorld" Text="Hello" meta:resourcekey="lblHelloWorld" /> Text="Hello" meta:resourcekey="lblHelloWorld" />

 In explicit localization we can use only a set of resource files for the whole application  We set bindings to names in the resource files manually  Use the expression property of controls <asp:Label runat="server" ID="lblHelloWorld" Text=" " Text=" " Font-Names=" " Font-Names=" " ForeColor=" " /> ForeColor=" " />

Live Demo

Questions?