Asp.net slide3

29 238 0
Asp.net slide3

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Asp.net slide

Session 5Web Server Controls Exploring ASP.NET / Session 5 / 2 of 29ReviewThe @ Page directive is used to specify attributes that affect the code in the .aspx page.The <script> section is where most of the code for providing the required functionality is written.There are two types of server controls:HTML ControlsWeb ControlsAll event procedures receive two arguments from the events:The event sender The class instance that holds data for the event The _VIEWSTATE control is a hidden control that is added to the form when the form is submitted to the server.It is possible to check whether a .aspx page is posted back to the server, with the help of the IsPostBack property of the page. Exploring ASP.NET / Session 5 / 3 of 29Review Contd…ASP.NET has several built-in objects that are used to provide the required functionality in an ASP.NET application. They are the following:RequestResponseApplicationSessionServerObjectContextThe base directory is called the virtual root, and the directory in which we store the application files is called the virtual directory.The Request object corresponds to the request message of the HTTP protocol, and the Response object corresponds to the response message of the HTTP protocol.The Form.Get method of the Request object is used to retrieve the data submitted by the user.The Redirect method of the Response object is used to redirect the user to another page. Exploring ASP.NET / Session 5 / 4 of 29ObjectivesExplain Web ControlsExplain why controls are objectsUse Controls for Text EntryUse Controls for Control TransferUse Controls for SelectionDiscuss Rich Controls Exploring ASP.NET / Session 5 / 5 of 29Web ControlsASP.NET ControlsIntrinsicListRichValidation Exploring ASP.NET / Session 5 / 6 of 29Web Controls as ObjectsLike objects, web controls possess methods and properties, and respond to events It is possible to set the properties and call the methods of the web controls once they are included onto the web pageServer-side code can be written for the web control to respond to events that occur on the client-side Exploring ASP.NET / Session 5 / 7 of 29Web Controls as Objects - Example<html><script language="C#" runat ="server" >void Button1click(Object Src, EventArgs E){lblMessage.Text =Src.ToString();btnButton1.Enabled = false;btnButton2.Visible = true;}void Button2click(Object Src, EventArgs E){lblMessage.Text="";btnButton2.Visible = false;btnButton1.Enabled = true;}</script> Exploring ASP.NET / Session 5 / 8 of 29Web Controls as Objects - Example<body><form runat="server"><asp:label id="lblMessage" text="Click on the button" runat="server"/><br><br><asp:button id="btnButton1" type = submit text= "Click me to know who I am" OnClick="Button1click" runat = "server" /><asp:button id="btnButton2" type = submit text= "Clear the label" visible=false OnClick="Button2click" runat = "server" /><br></form></body></html> Exploring ASP.NET / Session 5 / 9 of 29Web Controls as Objects - OutputOutput of Example 1 Before clicking the buttonOutput of Example 1 After clicking the button Exploring ASP.NET / Session 5 / 10 of 29<input type= “checkbox”><input type= “radio”><asp:CheckBox><asp:RadioButton><asp:TextBox rows=“1”><asp:TextBox rows=“10”><input type= “text”>< textarea>Intrinsic Controls [...]... Exploring ASP.NET / Session 5 / 25 of 29 Calendar Control - Example         Exploring ASP.NET / Session 5 / 26 of 29 Calendar Control - Output Exploring ASP.NET / Session 5 / 27 of 29 Summary  There are four sets of controls in ASP.NET: ... and properties and respond to events  ASP.NET provides three intrinsic controls for entering text They are as follows:    Single Line Entry Multi-Line Entry Password Entry Exploring ASP.NET / Session 5 / 28 of 29 Summary Contd…  There are four controls in ASP.NET that can be used to navigate between pages, or transfer control to a specified page:      ASP.NET provides the following set of... runat="server"/> Exploring ASP.NET / Session 5 / 11 of 29 Control Transfer - Intrinsic Control Posting data back to the server Save or access data from the server Navigate between the pages Exploring ASP.NET / Session 5 / 12 of 29 Control Transfer Exploring ASP.NET / Session 5 / 13 of 29 Intrinsic Control: Selection Exploring ASP.NET / Session 5 / 22 of 29 Calendar Control   In most cases, a calendar is used to allow the user to quickly choose a date, instead of manually typing it in The calendar control responds to two events   Date Changes Month Changes Exploring ASP.NET / Session 5 / 23 of 29 Calendar Control - Example . SelectionDiscuss Rich Controls Exploring ASP. NET / Session 5 / 5 of 29Web ControlsASP .NET ControlsIntrinsicListRichValidation Exploring ASP. NET / Session 5 / 6 of 29Web. >< ;asp: ListItem> One < /asp: ListItem> < ;asp: ListItem> Two < /asp: ListItem> < ;asp: ListItem> Three < /asp: ListItem> < /asp: dropdownlist>Intrinsic

Ngày đăng: 15/11/2012, 14:44

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan