Download presentation
Presentation is loading. Please wait.
1
Building ASP.NET Applications
Module 05: Building ASP .NET Applications Building ASP.NET Applications Lecture 5 T. Ahlam Algharasi 4th Level Copyright Microsoft 2001 July 15, 2001
2
Navigation Controls ASP.NET 2.0 has three new navigation controls:
Dynamic menus TreeViews Site Map Path
3
Navigation Controls Menu Control
The Menu control contains two types of items. StaticMenu that is always displayed on the page. DynamicMenu that appears when opens the parent item.
4
Navigation Controls Menu Control Properties of Menu Control
Description Properties to change the Menu orientation from horizontal to vertical. Orientation To add menu item item Indicates the text to display in the menu. Text Indicates the tooltip of the menu item when you mouse over. ToolTip Indicates the target location to send the user when menu item is clicked NavigateUrl indicates where to open the target location (in new window or same window). Target
5
Navigation controls Menu Control Properties of Menu Control
Description Properties Indicates the image that appears next to the menu item. ImageUrl Indicates the tooltip text to display for image next to the item. ImageToolTip Indicates the image that is displayed right to the menu item when it has some sub items. PopOutImageUrl
6
Navigation controls Menu Control Styles of Menu Control Description
Properties Sets the style of the parent box in which all menu items appears. StaticMenuStyle Sets the style of the selected static items. StaticSelectedStyle Sets the mouse hovering style of the static items. StaticHoverStyle To customize the appearance of dynamic menu. DynamicMenuStyle To customize the appearance of dynamic menu item selected by the user. DynamicSelectedStyle to set the styles for dynamic menu items to change their appearance when mouse moves over them. DynamicHoverStyle
7
Navigation controls TreeView Control
it is used to display the hierarchical data in tree view format. Properties of TreeView Control Description Properties Indicates the text to display in the node. Text Indicates the tooltip of the node when you mouse over. Tooltip Indicates the target location to send to the user when node is clicked. NavigateUrl Indicates the image that appears next to the node. ImageUrl
8
Navigation controls Styles of TreeView Control Description Properties
Space (in pixel) between current node and the node above or below it. NodeSpacing Space (in pixel) between the top and bottom of the node text. VerticalPadding Space (in pixel) between the left and right of the node text. HorizontalPadding Space (in pixel) between the parent node and its child node. ChildNodePadding
9
State Management Web is Stateless, which means When navigating from one page to the next, all information of the previous page is lost. If user inserts some information, and move to the next page, that data will be lost and user would not able to retrieve the information. State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
10
State Management Types of State Management: Hidden Fields
Query strings Session state Cookies Hidden Fields You can store page-specific information in a hidden field on your page without displaying it in the user's browser as a way of maintaining the state of your page. This type called (Client – Side State Management)
11
State Management Advantages of using hidden fields are:
No server resources are required . The hidden field is stored and read from the page. Widespread support . Almost all browsers and client devices support forms with hidden fields. Simple implementation . Hidden fields are standard HTML controls that require no complex programming logic. Disadvantages of using hidden fields are: Potential security risks Simple storage architecture .The hidden field does not support rich data types. Hidden fields offer a single string value field in which to place information. Storage limitations
12
State Management Query Strings
A query string is information that is appended to the end of a page URL. A typical query string might look like the following example: This type called (Client – Side State Management). Advantages of using query strings are: No server resources are required . Widespread support Simple implementation
13
State Management Disadvantages of using query strings are:
Potential security risks. The information in the query string is directly visible to the user via the browser's user interface. Limited capacity Some browsers and client devices impose a 2083-character limit on the length of URLs.
14
Session state Session state is used to store and retrieve information as user navigates from one page to another page in ASP. It is often used to maintain things such as the user’s name, the user’s ID, a shopping cart, or various other elements that are discarded when a given user is no longer accessing pages on the website. Every time you make a new request, ASP.NET generates a new session ID until you actually use session state to store some information.
15
Session state Advantages Disadvantages
It helps to maintain user states and data to all over the application. It can easily be implemented and we can store any kind of object. Stores every client data separately. Session is secure and transparent from user. Disadvantages Performance overhead in case of large volume of user, because of session data stored in server memory. With the use of Session state, it will affect the performance of memory, because session state variable stays in server memory until you destroy the state.
16
Session state Session state can be lost in several ways:
If the user closes and restarts the browser. If the user accesses the same page through a different browser window. If the session times out because of inactivity. By default, a session times out after 20 idle minutes. If the programmer ends the session by calling Session.Abandon().
17
Session state Properties of session Methods of session Description
The unique ID of the session SessionID The number of items in the session state collection Count Description Methods Removes all items from the session state collection Clear Removes the specified item from the collection Remove(name)
18
Session(" variable_name ") = value Session("variable_name")
Session state Store and Retrieve Session Variables Storing information in session variables Retrieving values from session variables Session(" variable_name ") = value Ex: Session("username")=“Ahmed“ Session(" username ") = Request.Form("TextBox1") Session("variable_name") Ex: Label1.text=Session("username”)
19
Session.Remove("fname")
Session state Store and Retrieve Session Variables Remove Session Remove all session Session.Remove("fname") Session.RemoveAll()
20
Session state Example 1 Make a link in a web page and it doesn’t allow the user to move to the next page before registering
21
Session state log in Button
Check the username and password if they are right store the username in a session
22
Session state Product Catalog link Button
23
Session state Example 2 Write a code for logging out
24
Session state Log out Button
25
Questions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.