btnSubmit.Attributes.Add("onclick", "this.disabled=true;" + Page.ClientScript.GetPostBackEventReference(btnSubmit, "").ToString());
This method is quite nice but if you would want to apply for entire website then you would have to duplicate the code in every page, usercontrols etc. Instead this simple script allows you to handle once for all
var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(InitRequest); prm.add_endRequest(EndRequest); function InitRequest(sender, args) { var btn = $get(args._postBackElement.id); if (btn && btn.type == "submit") { btn.disabled = true; } } function EndRequest(sender, args) { var btn = $get(sender._postBackSettings.sourceElement.id); if (btn && btn.type == "submit") { btn.disabled = false; } }
Above mentioned method is for ASP.NET ajax where update panels are used.
Hardware: the parts of a computer that can be kicked. ~Jeff Pesis
0 comments:
Post a Comment