Friday, August 28, 2015

Response.End(); & Download file or Export File Problem – Solution

Case:

When we came to download a file or Export it ,we know that we write Response.End(); to end the response and save the file to our machine,but if you try any other button in the page after that you notice that it doesn’t work! unless you make Refresh to the page! so what’s the solutoin?

Solution:

<script type=”text/javascript” language=”javascript”>
function ButtonWorkAgain()
{         window.WebForm_OnSubmit = function ()         { return true; };     }
</script>

<asp:GridView ID=”gvFiles” runat=”server” AutoGenerateColumns=”False” EnableModelValidation=”True”>
<Columns>
<asp:TemplateField>
<asp:LinkButton ID=”hlbtnDownLoad” runat=”server” onclick=”hlbtnDownLoad_Click”                                         OnClientClick=”ButtonWorkAgain();”></asp:LinkButton>
</asp:TemplateField>
</Columns>
</asp:GridView>

No comments:

Post a Comment