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:

javascript, js icon

<script type=”text/javascript” language=”javascript”>

function ButtonWorkAgain()

{         window.WebForm_OnSubmit = function ()         { return true; };     }

</script>

folder, html icon

<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>

Advertisements

One thought on “Response.End(); & Download file or Export File Problem – Solution

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s