State management & Master Pages in asp.net

Slides:



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

Developing a Web Site: Links Using a link is a quicker way to access information at the bottom of a Web page than scrolling down A user can select a link.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Unit 5: Building Presentation Layer Applications with ASP.NET 2.0.
Asp.NET Page Composition. Slide 2 Lecture Overview Work with master pages and content pages.
1 Chapter 12 Working With Access 2000 on the Internet.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
XP Tutorial 9 New Perspectives on JavaScript, Comprehensive1 Working with Cookies Managing Data in a Web Site Using JavaScript Cookies.
ASP.NET Programming with C# and SQL Server First Edition
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
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…
State Management. What is State management Why State management ViewState QueryString Cookies.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
Christopher M. Pascucci Basic Structural Concepts of.NET Managing State & Scope.
STATE MANAGEMENT.  Web Applications are based on stateless HTTP protocol which does not retain any information about user requests  The concept of state.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
CSE 409 – Advanced Internet Technology Today you will learn  Styles  Themes  Master Pages Themes and Master Pages.
1 CS 3870/CS 5870: Note 19 SiteMap and AJAX Lab 8.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
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 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
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.
Easy Site Navigation Getting organized, staying organized Creating custom site-navigation controls Using Menu, TreeView, and SiteMenuPath controls Make.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
Chapter 7 Navigation. Objectives How to move around in your site using server controls and plain HTML How to address pages and other resources like images.
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.
Site Maps and Navigation
4.01 How Web Pages Work.
Computing with C# and the .NET Framework
Objective % Select and utilize tools to design and develop websites.
Working with ASP.NET Master Pages.
Unit M Programming Web Pages with
Using ASP.NET Master Pages
Chapter 8 User Controls.
Objectives Design a form Create a form Create text fields
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
Website Navigation.
Haritha Dasari Josue Balandrano Coronel -
Objective % Select and utilize tools to design and develop websites.
CS 3870/CS 5870 Prog 6 Site Map.
CHƯƠNG IX: SITE NAVIGATION & USER CONTROL
Objective Understand web-based digital media production methods, software, and hardware. Course Weight : 10%
ASP.NET 4.0 State Management Improvements – Deep Dive
Building ASP.NET Applications
Building ASP.NET Applications 2
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Web Development Using ASP .NET
Menu.
Active server pages (ASP.NET)
MASTER PAGES.
NAVIGATION CONTROLS.
Active server pages (ASP.NET)
Web Application Development Using PHP
Website Navigation.
Presentation transcript:

State management & Master Pages in asp.net Created By: Asst. Prof. Ashish Shah State management & Master Pages in asp.net

Asp.net includes followng features Created By: Asst. Prof. Ashish Shah Asp.net includes followng features Client side : it is done using . View state . Cookies . Hidden fields . Query String(URL) 2) Server Side : it is done using . Session state . Application state . Caching

Created By: Asst. Prof. Ashish Shah View state It is about the state of the page and all its controls. It automatically maintains the post by asp.net framework. When page is sent back to the client for o/p , the changes in the properties of the page and its controls are determined and stored in the value of a hidden input field named _VIEWSTATE. When the page is again post back the _VIEWSTATE field is sent back to the server.

View state we can enabled/disabled it for Created By: Asst. Prof. Ashish Shah View state we can enabled/disabled it for Entire application : by setting view state property in <pages> section of web.config file. Page : this can be done by setting EnableViewState property. <%@ Page Language=“C#” EnableViewState=“true” %> 3) Control : This can be done by setting the control’s EnableViewState property.

Session State Modes Following are available modes: Created By: Asst. Prof. Ashish Shah Session State Modes Following are available modes: InProc : It stores session state in memory on the web server. This is the default. StateServer : It stores session state in separate process called as asp.net state service. SQL Server : It stores the session state in SQL Server database. Custom: It is done by custom storage provider Off mode: It disables Session State mode.

Cookies To create it the syntax is as follows. Created By: Asst. Prof. Ashish Shah Cookies To create it the syntax is as follows. HttpCookie studentcookie = new HttpCookie(“cook”); studentcookie.Value = text1.Text; studentcookie.Expires= DateTime.Now.AddHours(1); Response.Cookies.Add(studentcookie); . To Read the values from cookie: string studname=Request.Cookies[“studentcookie”].Value;

Created By: Asst. Prof. Ashish Shah QueryString It is a essential part of passing data from one web page to other. QueryString is a simply appending the data to the end of the URL; User can view the values of it without using any special oprations like “ViewSource”. Eg. http://www.jmpc.com?id=1 &name=tyit Note: ? Is a separator between the url and QueryString variables.

QueryString Advantages: Very easy to use. Disadvantages: Created By: Asst. Prof. Ashish Shah QueryString Advantages: Very easy to use. Disadvantages: If number of parameters increases then it becomes difficult to maintain the code using it. It can’t be used to send space character or “&”. It is visible in url of browser so secured information cant be send using it.

Created By: Asst. Prof. Ashish Shah MASTER PAGES It is used to make a consistent layout for an application, using which we can maintain common layout and functionality of whole application’s web page which is known as Content Pages. Master page has extension .master (infact it is a .aspx page) having directive as follows. <%@ Master Language=“C#” CodeFile=“MasterPage.master.cs” Inherits=master_MasterPage” %>

Created By: Asst. Prof. Ashish Shah MASTER PAGES Every master page should include at least one ContentPlaceHolder control as follows. <asp:ContentPlaceHolder id=“CPH1” runat=“server” /> The Content page is a standard aspx page in which MasterPageFile Attribute should be added to the page directive for binding the content page to the master page. The content page cant include the common tags as <body>,<head> etc. We can desing content page just like any other aspx page by adding static text and server controls. <%@ Page Language=“C#” MasterPageFile=“MasterPage.master” CodeFile=“Default2.aspx.cs” Inherits=“Default2” Title=“Masterpagedemo” %> Inside the content pages, by default, content server control is get added. While designing the content page you have to add controls to the content server control. For eg. <asp:Content ID=“CONTENT1” ContentPlaceHolderID=“CPH1” runat=“server” /> The attribute of ContentPlaceHolderID is very imp. As it decides what content will be bound tp which ContentPlaceHolder on the master page. It is a way to decide the location of where the contents is to be displayed.

Created By: Asst. Prof. Ashish Shah Navigation Controls Navigation for asp.net pages manages movement and dataprocessing between aspx pages. Web appn. are having multiple pages interconnected wth each other in some fashion, so proper navigation system must be there which can help end user to work successfully within an appn. Following are the three navigation controls SiteMapPath Menu TreeView

Created By: Asst. Prof. Ashish Shah SiteMapPath All navigation controls uses an XML-based file which is known as site map. Sitemaps are used to describe the logical structure of web application. It is used to define the layout of all pages in web application and how they relate to each other. Whenever we want to add or remove pages to sitemap, there by managing navigation of website efficiently. Sitemap files are defined with sitemap extension.

SiteMapPath The root node of sitemap file is <sitemap> element. Created By: Asst. Prof. Ashish Shah SiteMapPath The root node of sitemap file is <sitemap> element. Only one <sitemap> element can exist in the sitemap file. With in this element there is a <siteMapNode> element. This is generally the start page of the application, it has following attributes: Title: It provides a textual description of the link. Description: it is used for ToolTip of the link. URL: It gives the location of the valid physical file.

Created By: Asst. Prof. Ashish Shah Example of sitemap Home .I.T. DEPT FYIT SYIT To describe following logical structure the code of sitemap file is as follows.

Created By: Asst. Prof. Ashish Shah Example of sitemap <sitemap xmlns=“http://schemas.microsoft.com/aspnet/SiteMap-File-1.0 “> <siteMapNode url=“Default.aspx” title=“home” description=“go to homepage”/> <siteMapNode url=“It.aspx” title=“I.T. DEPT” description=“it dept information”> <siteMapNode url=“fyIt.aspx” title=“FYIT” description=“FYIT information” /> <siteMapNode url=“syIt.aspx” title=“SYIT” description=“SYIT information” /> </siteMapNode>

Created By: Asst. Prof. Ashish Shah MenuControl It is used to display menu in a web page and used in combination with SiteMapDataSource control for navigating a website. It displays to types of menu, static and dynamic. Static menu is always displayed , by default only one menu item at the root levels is displayed. Dynamic menu gets displyed only when the user moves the mouse pointer over the parent menu that contains a dynamic submenu.

Created By: Asst. Prof. Ashish Shah MenuControl To create menu control in master page , so it can be displayed in all subsequnet page, we have to write a following code below. <asp:Menu ID=“Menu1” runat=“server” DataSourceID=“SiteMapDataSource1”/> After saving the changes in master page all content page will get reflection automatically.

Created By: Asst. Prof. Ashish Shah TreeView Control A TreeView Control displays a Hierarchical list of data. When TreeView is displayed for the first time, it displays all its node. We can control it by setting ExpandDepth property. To create TreeView control in master page , so it can be displayed in all subsequent page, we have to write a following code below. <asp:TreeView ID=“TV1” runat=“server” />

TreeView Control Some Properties of it Properties Description Created By: Asst. Prof. Ashish Shah TreeView Control Some Properties of it Properties Description DataSourceID To specify datasource to be used using sitemap file as datasource ShowLines To specify the lines to connect the individual items in a tree CssClass To specify CSS class attribute for the control ExpandDepth To specify level at which items in the tree are expanded.