|
|
|
|
Preventing
multiple click of a submit button If you have certain operations going on, this might result in an error or submission of duplicate or multiple entries. It is a mistake, but should be taken care of in a page, usually where you submit a form. If your operations are going on in the click event of your button, it is not that possible to disable the button as you cannot do this on server side. It has to be done on client side using Java script. The On click attribute should be changed with a call to the GetPostBackReference method to call your actual code. All this can be done in just one line of code. It is a very useful when you process some data input forms and this one line of code does the trick. You can do any other process on Button Click event:
Sub Button1_Click (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Button1.Attributes.Item("onclick") = "this.disabled=true;" &
GetPostBackEventReference(Button1).ToString About the Author Sameer Lal, from Toronto, Canada, is a Project Mamangement Professional(PMP), Certified Management Accountant (CMA) from USA and Chartered Accountant (CA) from India. Sameer is also Certified Excel 2000 Expert and works as a consultant with one of the leading bank of Canada. |
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||