After Asp.net is submitted, it is still maintained. I have been very vague. I did a test and found that the client script is not maintained, it seems that, unless it is a server control and something changed on the server side, it is stored in the view State for maintenance, and others, it does not matter, you refresh or submit, it is all the same!
UpperCode:
<% @ Page Language = " C # " Autoeventwireup = " True " Codebehind = " Webform1.aspx. CS " Inherits = " Webapplication1.webform1 " %>
<! Doctype HTML public " -// W3C // dtd xhtml 1.0 transitional // en " " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< HTML xmlns = " Http://www.w3.org/1999/xhtml " >
< Head runat = " Server " >
< Title > </ Title >
< Script Type = " Text/JavaScript " >
Function outbtn_click ()
{
Document. getelementbyid ( " Outdiv " ). Innerhtml = " I got rid of you !! " ;
Document. getelementbyid ( " Indiv " ). Innerhtml = " I got rid of you !! " ;
Document. getelementbyid ( " Label1 " ). Innerhtml = " I got rid of you !! " ;
}
</ Script >
</ Head >
< Body >
< Div ID = " Outdiv " > I am outside </ Div >
< Input type = " Button " Value = " Outbn " Onclick = " Outbtn_click () " />
< Form ID = " Form1 " Runat = " Server " >
< Div ID = " Indiv " >
Haha, my div is in form. Test it and see that ASP will automatically maintain the status for me.
</ Div >
< ASP: Label ID = " Label1 " Runat = " Server " Text = " I'm a server-side control. Come on, I'm not afraid! " > </ ASP: Label >
< BR />
< ASP: button text = " Button " Runat = " Server " />
</ Form >
</ Body >
</ Html >
After pressing the outbn button, you can use the client js to modify the content of the control to be tested, as shown below:
When you press the button, all the content is changed back, whether outside the form, in the form, or even the server control. Because the content changed by the client is not in the Status view, therefore, it cannot be saved after submission.