In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you the necessity of ASP.NET server control view, I hope you will learn something after reading this article, let's discuss it together!
The necessity of the ASP.NET server control view: if our server control needs a more complete GUI, such as controlling the additional properties of the HTML element, such as font, color, height, etc., then we should inherit from the subclass WebControl of Control to get the required basic performance. Derived from the WebControl class, you need to follow the usual convention:
1. Contains a reference to the namespace from System.Web.UI.WebControl
2. The Render method cannot be overloaded to provide data directly to the output stream, but should be overloaded to implement the RenderContents method.
3. In general, the derived class of WebControl ends up as a tag in the output stream, but if you want to use other tags, you should overload the tagKey or TagName attribute of WebControl.
ASP.NET server control view learning experience (or MS recommendation):
1. If the control generates non-visual elements or displays them to non-HTML clients, then you should choose Control as the symbol class inheritance. Such as the label
2. Inheritance from WebControl that provides HTML interface
3. When extending the modification function, you should derive from an existing control, but not from the System.Web.UI.HtmlControls namespace, because the vs.net designer does not recognize controls derived from this class
In order to support the designer and implement the design time, you need to consider attribute (metadata) programming.
View state of the ASP.NET server control view
One of the most important aspects of Web programming is state management, which is to solve the problem of state management based on the stateless http protocol. In the era of asp-like web programming technology, this is usually solved by the following technical means:
1 、 Session
2 、 Cookies
3. Hide variables
4. URL carrying parameters
However, all the above schemes have their own shortcomings, such as Session is not suitable for expansion, Cookies may not be available under certain circumstances, hidden variables are not easy to manage, URL has limited length and limited capacity..
Considering comprehensively, MS puts forward the concept of ViewState (view) based on hidden variable scheme, which saves the server-side control state between two ASP.NET pages through the view. How does the view work?
After processing a Web request, the page framework collects the state of all controls in the page control tree and creates a view object. Each Control has a ViewState dictionary to save its own state. When outputting html to the client, all ViewState is serialized into a string expression, which is sent to the client as an implied variable. Usually, we pass the serialization substring of the view between the server and the client, and the implicit variable of the last request will be sent back to the server for parallelization, and then "restore" to the server control. In essence, it is an implicit variable, but the management function of ASP.NET is added on the basis of the implicit variable, which is the essence of the view.
Control's EnableViewState determines whether the control agrees to hand over its state to automated view management.
When a control needs to save state, no one can support a "simple native" data type such as int32 boolean. If it is a more complex attribute value type, the programmer needs to provide a type converter to convert the value data into a string, or if not, use the costly binary serialization function (byte by byte). View data is passed through an additional summary to ensure that the data is not tampered with (but there is no guarantee that it will not be snooped; after all, base64 coding is almost plaintext).
After reading this article, I believe you have a certain understanding of "the necessity of ASP.NET server control view". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.