I have an asp.net ImageButton -- with an OnClick event that another developer originally coded. It looks like this:
<asp:ImageButton ID="ImageButtonSaveAddress" runat="server" ImageUrl="btnSave.gif" OnClick="ImageButtonSaveAddress_Click" />
In the code behind, the event code looks like this ...
protected void ImageButtonSaveAddress_Click(object sender, ImageClickEventArgs e)
{
if (this.SaveAddressBook())
{
this.RedirectToAddressBook();
}
}
I would like to do 2 things. Part 1) disable the image button so it can't be resubmitted and Part 2) I would like to change the src of the imagebutton to a new "grayed out" button (to visually alert the user that the button has been pressed).
I was trying to do both Parts 1 & 2 with javascript (jQuery). Like this.
$j(".disable-submit").click(function() {
// replace the image
var $this = $j(this).attr("src", imgPathSaveBtnDisabled).addClass('wait-cursor');
// disable button from getting click again
// (this doesn't work, it just causes the page to stop)
return false;
});
It definitely feels like I'm going about this wrong.