Wednesday, August 19, 2009

Disabling submit Aspx button in C# .net

Following are simple ways to make a button disabled and fire the click event of the button in code behind .aspx file. Add this code in Page_Load event.

btnSubmitPay.Attributes.Add("OnClick", "this.disabled=true;return true;");

btnSubmitPay.Attributes.Add("onclick", "this.value='Please wait...';this.disabled = true;" + GetPostBackEventReference(btnSubmitPay));

btnSubmit.Attributes.Item("onclick") = "this.disabled=true;" & GetPostBackEventReference(btnSubmit).ToString();

No comments:

Post a Comment