The difference between an empty piece of a server control client and how to refresh a page without database data staying on the page

Source: Internet
Author: User

 difference: the server-side control will have a runat= "Server" property, 
in order to be able to modify it in the background,
that is, in the CS code can modify its settings.
You do the test, you put an HTML control in the CS code is not referenced in the name of the control
and then you add an HTML control runat= "Server" in the CS code can reference the control
essentially ASP. After parsing, return to the foreground or HTML control
you build a page to put a asp:textbox up
and then run the page, and then view the page source file
You'll find that the server control on it becomes the HTML inupt type= "button"

As you say, the view state should say this:
because the HTTP connection is stateless, each page request cannot log information from the last requested page.
then you want to save the value of the control on the last Request page, that is, after the page refresh, fill in the value of the same, for example, in the textbox filled with a ' a ', after the page refresh or ' a ',. NET Framework to implement this mechanism, the ViewState view state is used to hold the values of these controls,
So what is the value of all the controls there? You can run your program, and then view the source file in the page, you can see a input type= "hidden" name= "__viewstate" The label, this is what you call "view", it is serialized by the server, The server then deserializes the values of the hidden fields and then assigns the values to the controls again, so that the page refreshes and records the values of all the controls at the time of the last request. The server control will be saved by default ViewState has a property (EnableViewState) can be set, set to Flase will not save, the page refreshed, the value is gone, You can do a test put a TextBox set to EnableViewState to False, and then enter a value, and then use the button to refresh the page, then the textbox will be empty, because there is no view state record to the last value you entered.
Thank http://zhidao.baidu.com/link?url= l93vdzllr03j0stqforiqbolybjbitrruxpatyfrddkacj9p0o1t3wsshnakeolmtlqtd3p1ukv_e976-pne1k Author's share

The difference between an empty piece of a server control client and how to refresh a page without database data remaining on the page

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.