For details, refer to the following method:
/// <Summary>
/// Prevent repeated submission
/// </Summary>
/// <Param name = "imabuttons"> key set </param>
/// <Param name = "clientid"> the page contains JS verification components. </param>
Public void repeatsubmitcheckforrc (list <imagebutton> imabuttons)
{
Foreach (imagebutton button in imabuttons)
{
Stringbuilder sb = new stringbuilder ();
SB. append ("If (typeof (page_clientvalidate) = 'function') {If (page_clientvalidate () = false) {return false ;}};");
If (button. ID! = "Savebutton ")
{
SB. append ("If (! Contentrequiredvalidator () {return false}; "); // empty verification for rich text editing
}
SB. append ("This. Disabled = true ;");
SB. append (this. Page. clientscript. getpostbackeventreference (button ,""));
SB. append (";");
Button. Attributes. Add ("onclick", SB. tostring ());
}
}
When calling a method
List <imagebutton> imabuttons = new list <imagebutton> ();
Imabuttons. Add (sumbitbutton );
Imabuttons. Add (savebutton );
Repeatsubmitcheckforrc (imabuttons );