There is a web form which perform the downloading functionality.When user click on the button it become disable first(Using JS OnClientClick method) and then downloads(Implementation in OnClick method in code behind) the relevant file after triggering the button click.I want to enable the button again after completion of the download.
Previously this was worked fine using the Cookies(Added a cookie there in code behind and continuously read it from JS).But I enabled secure cookie mechanism and now it won't disable the button.
Any alternative mechanism to get the button enable ?
Nothing worked as it running when Post Back of the page
//aspx page
<asp:Button ID="btn" runat="server" Text="Download" UseSubmitBehavior="false"
OnClientClick="Download(this)" OnClick="btn_Click" />
function Download(element) {
element.disabled = true; //button become disable
}
//codebehind
protected void btn_Click(object sender, EventArgs e)
{
var data = getData();
Response.AddHeader("Content-Length", userDataText.Length.ToString());
Response.ContentType = "text/csv";
Response.AppendHeader("content-disposition", string.Format("attachment;filename=\"{0}\"", "download_file"));
Response.Write(data);
Response.Flush();
Response.End();
}
I expect to disable the button after downloading the csv file.Solution should not be depend on cookies.But actual doesn't do such functionality.