Jun 06, 2011, 12:19 PM
Download txt file problem
Can anyone help me with this problem:
I have a direct event and in it create txt file, which then I want to send to the client. The problem is that file opens directly in browser, but I need to directly download it.
Here is the code:
I try to put:
I used this logic for excel files and it works correctly, but for txt not.
Anyone knows how to do this?
I have a direct event and in it create txt file, which then I want to send to the client. The problem is that file opens directly in browser, but I need to directly download it.
Here is the code:
protected void ButtonGetTxt_DirectClick(object sender, DirectEventArgs e)
{
...
...
Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
Response.ContentType = "text/plain";
Response.Redirect(filePathURL);
}
<ext:Button ID="ButtonGetTxt" runat="server" Text="Get txt" Disabled="true">
<DirectEvents>
<Click OnEvent="ButtonGetTxt_DirectClick" >
<ExtraParams>
<ext:Parameter Name="param1" Value="Ext.encode(getNZP())" Mode="Raw"></ext:Parameter>
</ExtraParams>
<EventMask ShowMask="true" Target="Page" Msg="<%$ Resources:Rsc, Loading %>" />
</Click>
</DirectEvents>
</ext:Button>
I try to put:
IsUpload="true"
but it not work.I used this logic for excel files and it works correctly, but for txt not.
Anyone knows how to do this?