How to change the value of DropDownList to the default value after clicking the submit button
This article mainly shows you "how to click the submit button after the value of DropDownList into the default value", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to click the submit button after the value of DropDownList becomes the default value" this article.
After clicking the submit button, all the control values bound to the database on the page are restored to their default values
The reason is to write the binding function loadData () in the
If (! IsPostBack)
{
Your binding function
}
Otherwise, the page reloads and the values of all controls change to initial values.
IsPostBack is a property of the Page class that has a bool type that determines whether the current page is being loaded in response to a client postback or is being loaded and accessed for the first time.
When IsPostBack=true indicates that it is loaded in response to a client postback.
When IsPostBack=false indicates that it is being loaded and accessed for the first time.
In other words, the binding function is executed only when the IsPostBack=false is, which does not cause the page to overload and cause the page control to initialize.
The above is all the contents of the article "how to change the value of DropDownList to the default value after clicking the submit button". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!