Link to home
Start Free TrialLog in
Avatar of jj819430
jj819430

asked on

ASP.NET 2.0 Button One Click

Ok, so this was an issue in 1.1 but I could always do a work around using this.Page.GetPostBackEventReference(this) to force the post and some javascript. Now with 2.0 I can't seem to get it to work. Anyone got a good solution for 2.0 that allows a button/image button to be clicked only once?
You can't set it to disabled=true because then the server side will presume it is disabled. And the data won't be posted correctly.
I can't figure out where the WebForm_DoPostBackWithOptions is done, any ideas on that one as well?
ok, if anyone knows or has the server control that will work for either imagebutton or button for this I appreciate it.
jj
ASKER CERTIFIED SOLUTION
Avatar of nehaya
nehaya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jj819430
jj819430

ASKER

this still gives the same issue.... the button doesn't post back once.
nvm solved it myself.
Basically created a server control that writes out 2 divs, 1) = the button or image button, 1 = the stuff to show while the backend is processing.
wrap the onclick event of the button/imagebutton with the following javascript code at the pre-render state
if(Page_ClientValidate( TheValidationGroupName )){ myScript; TheOriginalOnClick;}

the I created a small javascript framework that gets called and swaps out the display property of the divs.

Credit for where I started goes to Mike Ellision
http://www.codeproject.com/aspnet/PleaseWaitButton.asp

You will want to re-write a bunch of it but it is a great way to start to solve this problem. Today mike is my hero

But remember to update the system to work in 2.0 correctly and support groupvalidations

ii819430-

I'm looking for the same functionality for my image button. Can I get a copy of your button? Many thanks