Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Disable submit button when clicked with a master page

$
0
0

I have a submit button on an ASPX form that has a master page. I need to disable the submit button once it's been clicked to prevent multiple clicks.

I tried this:

VB.NET code:
--------------------
              MyButton.Attributes.Add("onclick", "DisableSave('ctl00_ContentPlaceHolder1_MyButton');")

 

Javascript Code:       
--------------------
function DisableSave(sButton) {
            var btn = document.getElementById(sButton);
            btn.disabled = true;
            __doPostBack;
            //document.aspnetForm.submit();
        }

(I tried each of the last two lines in the Javascript, individually and together)

 

This worked, except that I didn't have my submit button in the form data, so my code doesn't know what to process. I do know that a PostBack occurred, but since I have several different submit buttons on the web page, I don't know which one caused the postback.

 

This seems like it should be very simple to do - what am I missing here??

 

thanks,



Viewing all articles
Browse latest Browse all 23244

Trending Articles