Disable Button while processing request in VB.Net

Hi,

I'm trying to simply disable an ASP:Button while processing database requests in VB.Net. Since you need a postback to have your btnReset.Enabled = False to take into effect, I'm thinking the only way is to do it in JavaScript. But when doing it in JavaScript and doing a btnReset.Attributes.Add("onClick", "...javascript..."), it does disable the button but nothing else executes after that. How can I achieve what I'm trying to do in the simplest form?

Thanks for your help,
JS
gometangAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Timbo87Commented:
btnReset.Attributes.Add("onClick", "this.disabled = true; document.forms[0].submit();")
0
gometangAuthor Commented:
I don't think that's going to work. I have my logic in the btnClick event:

Private Sub btnResetEnrollment_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResetEnrollment.Click

If I do a regular form submit (post back), it will just go the Page_Load event and not into the method above, which is what I want. Basically, I want to achieve the following based on the user clicking the button:

1. Disable button
2. Execute everything in the btnResetEnrollment_Click event (BTW, I'm aware that I just put btnReset in the example above as it just served as an example)

Thanks,
JS
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.