What is ASP.NET's Web Formsasp.Net Web Forms page framework is an upgradeable Universal Language Runtime (CLR) program model to dynamically generate web pages in the server side. (Americans talking is awkward, in fact, Web Forms is the page written by ASP.NET) as the rational evolution of ASP (ASP.NET provides syntax compatibility with existing ASP), the design purpose of the ASP.NET Web Forms framework is used to solve Insufficient ASP mode. It provides: • Create and use reusable user interface controls, components that are commonly used, reduce the workload of page developers writing code. · Provide developers with clear structure, well-plated page logic (rather than "Italian noodles"). · Provide a powerful page development tool (ASP code for tool is opaque) This part of this part of this textbook provides a high level of code, which is a preliminary introduction to the key features of ASP.NET Web Forms. Subsequent chapters will analyze the function of ASP.NET Web Forms to write the first Web Forms page ASP.NET Web Forms page is a text file with an ASPX to extension. They can be configured through the IIS virtual root directory tree. When the browser client requests. Aspx resources, the ASP.NET runtime library analysis and compiling the target file, formation the .NET framework class. This class can be used to dynamically process the upcoming request. (Note: .aspx files only compiled when they were first accessed; compiled results were reused in future requests). You can easily change the extension of the HTML file to ASPX to get an ASP.NET file (you don't need to modify any code). For example, the following example demonstrates an HTML page that collects the user's name and classification preference, then submit the form when the button is pressed. C # INTRO1.ASPX [Run] | [Source Procedure] Important: Note that nothing will happen when you click the Lookup button. This is because .aspx file only contains static HTML (without any dynamic content). Therefore, the same HTML will return to the client when each round trip, the field content of the form is lost during the submission process. Use ASP <%>> Reference flag ASP.NET provides syntax compatibility with existing ASP pages. This compatibility includes the <%> code reference block, in the .aspx file, it can be mixed with HTML content. These code blocks are executed from the top of the quote. The following example demonstrates how to use the <%%> reference flag in the HTML block (increasing the font size in turn)
C # INTRO2.ASPX
[Run] | [Source Procedure] Important: Unlike ASP, the code used in the top <%>> block is really compiled, not the interpretation of the scripting engine. Therefore, it is improved in operational efficiency. ASP.NET page developers can use <%%> Code block dynamically modify the output of HTML, just like using ASP. For example, the following example demonstrates how to use <%%> to implement the result of the response client submit.
C # intro3.aspx
[Run] | [Source Procedure] Important: <%%> Code block provides a powerful way to achieve custom and operating text output from the ASP.NET page, but there is no clear programming program. As the example above, the developer only uses <%%> code block, you must send a round trip in the request, manage the page status, and manage the value sent after the explanation. ASP.NET Server Control This section describes how to use the ASP.NET server control in addition to the program that uses (or as an instead) <%%> to make the state content. When declaring server space in the .aspx file, use the ASP.NET specific tag or use the HTML tab containing the runat = "server" property. The HTML tag is used as the control used by the control, and is defined in the namespace system.web.ui.htmlControls. Any label that cannot be mapped to the control is assigned to System.Web.ui.htmlControls.htmlGenericControl type. The following example uses four server controls:
[Run] | [Source Procedure] Important: In the loop round trip passing to the server (Rount Trips ----- I don't know how to translate this vocabulary, what he means to submit data from the client to the server, then from During the process of the server returns the process of data, these server controls automatically keep any client input value (which is scheduled for the loop to return, the form "is saved in ). Also note that in ASP.NET does not require any client script support, in addition to supporting standard HTML input controls, ASP.NET allows developers to use a richer custom control in the page. For example, the following example demonstrates how to use
C # intro5.aspx
[Run] | [Source Procedure] Important: All built-in server controls are provided in the Web Forms Control Reference section of this tutorial. ========== to be continued. . .