Abstract: this paper Introduces Some Methods of Reusable Web Page Which Combining with the Features of ASNET, AND TAKING A Web Page of A News Web Site As an Example. Keywords: ASP.NET Double User Control Inheritment Key Words: ASP .NET Reusable User Controls Inherit 0, introduction With the continuous development of the network, the web-based B / S architecture is the mainstream of the current application, in which business logic and database are placed in server segments, users are browsing The server operates the data of the server. Before the Microsoft.Net platform has not been launched, people can achieve the above objects through the ASP, and now you can choose ASP.NET. ASP.NET is a compiled, based .NET-based environment that creates applications with any .NET compatible language (including Visual Basic.net, C #, and JScript.net.). Any ASP.NET application can use the entire .NET Framework. In contrast, the ASP is an interpreted programming framework. The scripting language is VBScript and JavaScript. These two languages are limited. They need to use components written in languages such as C , Java to extend their functions, and the interpretation is running , Limited efficiency. 1. The problem proposes a website, especially the website that combines with the database (such as news websites, product introduction websites, etc.), there are many web pages, different only data related to the database (such as different news content, different Product, etc.). We don't have to write a file for each page, the cost of doing is too high, we can fix the constant part, and the changed part is dynamically generated according to the client request. Take a news website page containing header, footer, navigation bar as an example. The sample page is as follows: 2. Solution ASP.NET introduces the concept of web form user controls, using it we can easily create customized Reusable controls. The user control can be compiled and stored in the server memory during the first request, which can shorten the response time of the subsequent request. User control inherits from System.Web.ui.userControl. We can make headers, footers, and navigation columns into user controls. For simplicity, the header only contains a picture pointing to the home page. The new file Header.ascx, the content is as follows: <% @ Control%>
"IMG alt =" "src =" image / banner1.jpg "border =" 0 "> td> tr> table> footer is two lines of text , Implement the form of two lines.
New files FOOTER.ASCX, the content is as follows: <% @ Control%>
|