After clicking the Submit button, all control values on the page that are bound to the database are restored to the default value
The reason is to write the binding function loadData() in
if(!IsPostBack)
{
Your binding function;
}
Otherwise, the page will be reloaded and the values of all controls become initial values.
IsPostBack is a property of the Page class that has a bool type, which is used to determine whether the current page is loading in response to client postback or is being loaded and accessed for the first time.
When IsPostBack=true, it is expressed as loading in response to client postback.
When IsPostBack=false, it means it is being loaded and accessed for the first time.
That is to say, only if IsPostBack=false is executed, bind the function, so that it will not cause page overloading and lead to page control initialization.
IsPostBack Introduction:
/en-us/library/
/doc/
The reason is to write the binding function loadData() in
if(!IsPostBack)
{
Your binding function;
}
Otherwise, the page will be reloaded and the values of all controls become initial values.
IsPostBack is a property of the Page class that has a bool type, which is used to determine whether the current page is loading in response to client postback or is being loaded and accessed for the first time.
When IsPostBack=true, it is expressed as loading in response to client postback.
When IsPostBack=false, it means it is being loaded and accessed for the first time.
That is to say, only if IsPostBack=false is executed, bind the function, so that it will not cause page overloading and lead to page control initialization.
IsPostBack Introduction:
/en-us/library/
/doc/