I have a repeater with a button in that saves some data to the DB. My issue is sometime the call down to the DB takes a little bit and the user sometimes will click save a few times causing multiple entries to be added to the db. So my first thought was to add a throbber and disable the button when its clicked. The throbber is spinning away but when the button is disabled it prevents the call to the server. So I looked at this but since I have a bunch of different buttons (Update, Add, ...) that there are a few different server side methods being called so I can t just post __doPostBack($(button).attr( id ), )
.
So i was thinking that I might need to do a ajax call but I wanted to see if there was any other ideas.
Here s my code: The onClientClick
is actually being setup on the server side but this is basically whats being done.
<>Repeater
<div style="position: relative; float: left;">
<asp:Button ID="btnSave" runat="server" Text="Assign" OnClientClick="return fnAssignedButtonPressed(this);", OnClick="btnSave_Click" />
</div>
www.un.org/Depts/DGACM/index_spanish.htm
function fnAssignedButtonPressed(button) {
//validating inputs
var valid = true;
if(valid)
{
$(button).attr( disabled , disabled );
showWaitCursor(true);
__doPostBack($(button).attr( id ), );
}
return valid;
}
<>Serverside:
protected void btnSave_Click(object sender, EventArgs e)
{
//save
// This method doesn t call called when I disable the button!!
}