1 / 13

Creating a Microsoft ASP.NET Web Form

Creating a Microsoft ASP.NET Web Form. Overview. Creating Web Forms Using Server Controls. Lesson: Creating Web Form s. What is a Web Form? A web form is ASP.NET component that allows programmers build a web page. Creating a Web Form with Visual Studio .NET. What Is a Web Form?.

kreeli
Télécharger la présentation

Creating a Microsoft ASP.NET Web Form

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creating a Microsoft ASP.NET Web Form

  2. Overview • Creating Web Forms • Using Server Controls

  3. Lesson: Creating Web Forms • What is a Web Form? • A web form is ASP.NET component that allows programmers build a web page. • Creating a Web Form with Visual Studio .NET

  4. What Is a Web Form? • .aspx extension • Page attributes • @ Page directive • Body • Form <%@ Page Language="vb" Codebehind=“Default.aspx.vb" Inherits="_Default"%> <html> <body> <form id="Form1" runat="server"> </form> </body> </html>

  5. Creating a Web Form with Visual Studio .NET • New ASP.NET Web Applications create a default Web Form: Default.aspx • Create additional Web Forms from the Solution Explorer

  6. Lesson: Using Server Controls • What is a Server Control? • Types of Server Controls • Saving View State • Demonstration: Converting HTML Controls to Server Controls • HTML Server Controls • Web Server Controls • Selecting the Appropriate Control

  7. What is a Server Control? <asp:Button id="Button1" runat="server" Text="Submit"/> • Runat="server" • Events happen on the server • Have built-in functionality • Common object model • All have Id and Text attributes • Create browser-specific HTML

  8. Types of Server Controls • HTML server controls • Ex) <input id="Button1" type="button" value="button" runat="server" /> • Web server controls • Ex) <asp:Button ID="Button2" runat="server" Text="Button" /> • Intrinsic controls • Validation controls • Rich controls • List-bound controls

  9. Demonstration: Converting HTML Controls to Server Controls • Upgrade HTML controls to HTML server controls • Add a Web server control

  10. HTML Server Controls • Based on HTML elements • Exist within the System.Web.UI.HtmlControls namespace <input type="text" id="txtName"runat="server" />

  11. Web Server Controls • Exist within theSystem.Web.UI.WebControls namespace Control syntax HTML that is generated by the control <asp:TextBox id="TextBox1" runat="server">Text_to_Display </asp:TextBox> <input name="TextBox1" type="text" value="Text_to_Display" Id="TextBox1"/>

  12. Selecting the Appropriate Control Use HTML Server Controls if: Use Web Server Controls if: You prefer an HTML-like object model You prefer a Visual Basic-like programming model You are working with existing HTML pages and want to quickly add ASP.NET Web page functionality You are writing a page that might be used by a variety of browsers The control will interact with client and server script The control will interact with server script Bandwidth is limited Bandwidth is not a problem

  13. Demonstration: Adding Server Controls to a Web Form • Create a Web Form • Add TextBox, Button, and Label controls • Add a Calendar control

More Related