[Webinar] Learn how to a build a cloud-first strategyRegister Now


Disable Button while processing request in VB.Net

Posted on 2004-11-03
Medium Priority
Last Modified: 2010-05-18

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,
Question by:gometang
LVL 15

Expert Comment

ID: 12488202
btnReset.Attributes.Add("onClick", "this.disabled = true; document.forms[0].submit();")

Author Comment

ID: 12488951
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)

LVL 20

Accepted Solution

ihenry earned 2000 total points
ID: 12489980

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question