After you have developed the program in ASP, the TextBox control needs reset after the data is inserted. If there are only one or two file boxes there may be no problem, if there are many text boxes on the page, you will have a problem.
In addition to a situation, some text boxes have default values and cannot be implemented as loops.
As today on the forum to see a netizen's wording:
protected void Button2_Click (object sender, EventArgs e) { this ' this ' This This is this"; }
Considering that you might as well reset the other Web control checkbox,dropdownlist, so you can write an interface:
The above user reset, is all TextBox control, so you can write a class, it inherits the TextBox, and then you can implement the Reset method of the interface:
Prepare examples and demos, such as many text boxes below the page, some with default values, some not. Users first enter some values, or change the default values, then click the reset button:
<formID= "Form1"runat= "Server"> <Div> <Asp:textboxID= "TextBox1"runat= "Server"Text= "Leo"></Asp:textbox><BR/> <Asp:textboxID= "TextBox2"runat= "Server"></Asp:textbox><BR/> <Asp:textboxID= "TextBox3"runat= "Server"></Asp:textbox><BR/> <Asp:textboxID= "TextBox4"runat= "Server"Text= "Yang"></Asp:textbox><BR/> <Asp:textboxID= "TextBox5"runat= "Server"></Asp:textbox><BR/> <Asp:textboxID= "TextBox6"runat= "Server"></Asp:textbox><BR/> <Asp:textboxID= "TEXTBOX7"runat= "Server"Text= "Insus.net"></Asp:textbox><BR/> <Asp:textboxID= "TextBox8"runat= "Server"></Asp:textbox><BR/> <Asp:buttonID= "Button1"runat= "Server"Text= "Reset"OnClick= "Button1_Click"/> </Div> </form>
View Code
The following is the button1_click event for the Reset Ammonium button:
Dynamic real-time operation:
Have time to implement Dropdownlist,checkbox and other controls ...
How to implement the Web Control text box reset function