Refill button with image in ASP. NET

Source: Internet
Author: User

The implementation record of the refill button during my first system operation is as follows:

You can set the background image with imagebutton for the first time, and then write the following in the Click Event of the background:
This. txtcallno. Text = "";
This. txtcaller. Text = "";
This. txttrandate. Text = "";
This. txttranlimit. Text = "";
This. txttranno. Text = "";
This. txttranpres. Text = "";
This. radiobutton1.checked = false;
This. radiobutton2.checked = false;
This. dlstunit. selectedindex = 0;
The second operation also uses imagebutton, which is written in the click event as follows:
Foreach (control C in form1.controls)
{
If (C is textbox)
(Textbox) c). Text = "";
If (C is dropdownlist)
(Dropdownlist) c). selectedindex = 0;
If (C is radiobutton)
(Radiobutton) c). Checked = false;
}
The third time is to use <a href = "#">
Use JavaScript to write the reset () method:
Function reset ()
{
VaR Len = Document. form1.elements. length;
VaR I;
For (I = 0; I <Len; I ++)
{
If (document. form1.elements [I]. type = "text ")
{
Document. form1.elements [I]. value = "";;
}
If (document. form1.elements [I]. type = "radio ")
{
Document. form1.elements [I]. Checked = false;
}
}
VaR obj1 = Document. getelementbyid ("dlstcallerway ");

VaR obj5 = Document. getelementbyid ("txtremark ");
Obj5.value = "";
Obj1.selectedindex = 0;
// The client type of the dropdownlist cannot be obtained. I do not know how to obtain the Js.
// When the textmode of the text box is set to multiline, the type can only be obtained by ID if it cannot be obtained.
}
These three methods are empty, not reset or refill, because sometimes the reset request is that the original data is retained after you click the reset button in the control.

Data. For example, when textbox1 loads a page, the value is "Hu Shuai". After clicking it, it is still "Hu Shuai". The preceding method is cleared after clicking it.
Method 4:
<Input type = "image" src = "images/but2.gif" name = "reset"
Onclick = "form1.reset (); Return false;"/>

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.