I am using the UseSubmitBehaviour Property of Button. when click on the Button, before click event , i m using OnClickClick function of Button, here i am disabling the Button and changed the Text of Button to Please Wait.. . after complete the click event action, it automatically comes to the previous state, The Button is enabled and the Text of Button changed to Submit.
Now my problem which i am facing in this process is that
When on button click , i am adding the Excel Download code, after complete the click event action, it does not come to the previous state, means it only remains as 'Please Wait.' and the button remain disabled. how to do it ? Please Help
What I have tried:
<asp:Button ID="btnGetData" runat="server" Text="Get Data" CssClass="btn" style="width:auto; padding:3px 7px;" UseSubmitBehavior="false" CausesValidation="false"
OnClientClick="this.disabled=true; this.value='Please Wait..';" />
on button click :
Try
Dim excel_name As String = "E2E Report"
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.Write("<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">")
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + excel_name + "(" + System.DateTime.Now + ").xls")
HttpContext.Current.Response.Charset = "utf-8"
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250")
HttpContext.Current.Response.Write("<font style="font-size: 10.0pt; font-family: Calibri">")
HttpContext.Current.Response.Write("<br><br><br>")
HttpContext.Current.Response.Write("")
Dim columnscount As Integer = GridView1.Columns.Count
For j As Integer = 0 To columnscount - 1
HttpContext.Current.Response.Write("")
Next
HttpContext.Current.Response.Write("")
For Each row As DataRow In table.Rows
HttpContext.Current.Response.Write("")
For i As Integer = 0 To table.Columns.Count - 1
HttpContext.Current.Response.Write("")
Next
HttpContext.Current.Response.Write("")
Next
HttpContext.Current.Response.Write("<table border="1" cellspacing="0" cellpadding="0"> <tbody><tr><td>")
HttpContext.Current.Response.Write("")
HttpContext.Current.Response.Write(GridView1.Columns(j).HeaderText.ToString())
HttpContext.Current.Response.Write("")
HttpContext.Current.Response.Write("</td></tr><tr><td>")
HttpContext.Current.Response.Write(row(i).ToString())
HttpContext.Current.Response.Write("</td></tr></tbody></table>")
HttpContext.Current.Response.Write("</font>")
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.[End]()
Catch ex As Exception
End Try