Web control text box Reset's functionality

Source: Internet
Author: User

In the previous article, "How to implement the Web control text box reset" http://www.cnblogs.com/insus/p/4120889.html insus.net only implemented the function of the text box. Single or multiple, with default values and no values. As soon as the user clicks Reset, we are going to reset the Web control.

Refer to the blog post, you can actually write the other controls to reset the function. such as Dropdownlsit,listbox,checkbox,checkboxlist,radiobuttonlist and so on.

To implement what the control reset function requires, you need to create a custom class and inherit it.

The following is a CheckBox control:



ListBox control Reset Function:



CheckBoxList CONTROLS:


DropDownList controls:


RadioButtonList CONTROLS:

Here's how to use the program to illustrate:

 <Asp:textboxID= "TextBox1"runat= "Server"Text= "Leo"></Asp:textbox><BR/>                      <asp:dropdownlistID= "DropDownList1"runat= "Server">                <Asp:listitemValue= "A"Text= "A"></Asp:listitem>                <Asp:listitemValue= "B"Text= "B"></Asp:listitem>                <Asp:listitemValue= "C"Text= "C"></Asp:listitem>                <Asp:listitemValue= "D"Text= "D"></Asp:listitem>                <Asp:listitemValue= "E"Text= "E"></Asp:listitem>                <Asp:listitemValue= "F"Text= "F"></Asp:listitem>                <Asp:listitemValue= "G"Text= "G"></Asp:listitem>            </asp:dropdownlist><BR/>            <Asp:checkboxID= "CheckBox1"runat= "Server" /><BR/>            <asp:checkboxlistID= "CheckBoxList1"runat= "Server"RepeatColumns= "7">                <Asp:listitemValue= "A"Text= "A"></Asp:listitem>                <Asp:listitemValue= "B"Text= "B"></Asp:listitem>                <Asp:listitemValue= "C"Text= "C"></Asp:listitem>                <Asp:listitemValue= "D"Text= "D"></Asp:listitem>                <Asp:listitemValue= "E"Text= "E"></Asp:listitem>                <Asp:listitemValue= "F"Text= "F"></Asp:listitem>                <Asp:listitemValue= "G"Text= "G"></Asp:listitem>            </asp:checkboxlist><BR/>            <asp:radiobuttonlistID= "RadioButtonList1"runat= "Server"RepeatColumns= "3">                <Asp:listitemValue= "A"Text= "A"></Asp:listitem>                <Asp:listitemValue= "B"Text= "B"></Asp:listitem>                <Asp:listitemValue= "C"Text= "C"></Asp:listitem>            </asp:radiobuttonlist><BR/>            <Asp:listboxID= "ListBox1"runat= "Server"SelectionMode= "multiple">                <Asp:listitemValue= "A"Text= "A"></Asp:listitem>                <Asp:listitemValue= "B"Text= "B"></Asp:listitem>                <Asp:listitemValue= "C"Text= "C"></Asp:listitem>                <Asp:listitemValue= "D"Text= "D"></Asp:listitem>                <Asp:listitemValue= "E"Text= "E"></Asp:listitem>            </Asp:listbox><BR/>            <Asp:buttonID= "Button1"runat= "Server"Text= "Reset"OnClick= "Button1_Click" />
View Code

Now write the Reset Ammonium button event, you can not copy the previous method, but need to modify, because all the customizations have implemented interface iresetcontrolable.



Dynamic Operation Demo:


All of the above controls are shown in the demo, only one, if in an Ammonium button event, for multi-control, we need to how to optimize the above program, which needs to be modified, which does not need to move. In fact, in ASP. NET development, the use of control is more opportunity to learn the object-oriented technology and knowledge.

Web control text box Reset's functionality

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.