Asp.net 1.1 second reuse of User Controls

Source: Internet
Author: User
Although. NET Framework 2.0 has been released, some changes have also been made in the use of Asp.net. However,. Net framework1.1 is still my main development platform. In Asp.net 1.1, a new model named user-defined control is added. It may not be a model, or a method. I personally think this is a replacement of the include method used in the previous ASP to include a file. In many cases Code To make controls, you can achieve better reuse. Is there no doubt about this?
However, the user controls made in Asp.net 1.1 can be reused at a level, that is, to use the same function, you only need to put the existing user controls there. However, this is only the reuse of fixed code and fixed data. What if dynamic data of fixed code needs to be reused? Here, I will explain the fixed code here and the meaning of fixed data reuse. In fact, it means that it will implement a specific function and reuse the code for getting a specific fixed data, just like a user's login control, the functions and data used on the homepage are the same as those on the dedicated login page. This is also the first level of reuse of user controls. In fact, the reuse of this method can reduce the workload, but we want to further reuse these Custom User Controls, without re-writing the relevant code to implement similar functions, we need to implement another level of reuse.
As mentioned above, fixed code and dynamic data are used for reuse at the second level. All Web developers should know that different attribute identifiers can be added to an HTML tag to set the display or status of the tag, for example, in a <TD width = "50%"> table, you can set the width to 50%, or set other attributes to change its display, in Asp.net 1.1, most server controls can set a certain attribute to change its display or other states. The most basic one is the ID attribute, each server-side control should be used.
A user-defined control displays a page without <HTML> First, in the web. config or custom XML file definition, some related user control parameters of dynamic data with fixed code and corresponding ID values should be implemented. These user controls are then placed on different pages and identified based on the ID number defined in the configuration file. Finally, the dynamic input parameters are obtained. Obtain the id value of the user control in the background code, and then use this ID value as the key value for searching the parameter values in the configuration file. Then, you can obtain the input parameter values of different ID values, in this way, the so-called fixed code and dynamic data can be reused.
If there are any deficiencies, please point out.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.