Hi,
am using old Rad control. "RadAjax.Net2" of "Telerik.WebControls"
i have a button inside RadAjaxPanel to download a text file from server.
ASPX Code :
<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>
<radA:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Width="100%" >
<table>
<tr>
<td>
<asp:Button ID="btnBillingFile" runat="server" Text="Generate billing file" OnClick="btnBillingFile_Click" />
</td>
</tr>
</table>
</radA:RadAjaxPanel>
C# Code :
protected void btnBillingFile_Click(object sender, EventArgs e)
{
string fileTabDelimited = ConfigurationManager.AppSettings["KEY_DOCUMENT_FOLDER"] + @"\Billing Files\BillFile.txt";
FileInfo fileInfo = new FileInfo(fileTabDelimited);
if (fileInfo.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileTabDelimited);
Response.AddHeader("Content-Length", fInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(fileTabDelimited);
//Response.End();
}
}
but not working. This code can not prompt to Open/Save dialog.
please help.
Chandan
am using old Rad control. "RadAjax.Net2" of "Telerik.WebControls"
i have a button inside RadAjaxPanel to download a text file from server.
ASPX Code :
<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>
<radA:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Width="100%" >
<table>
<tr>
<td>
<asp:Button ID="btnBillingFile" runat="server" Text="Generate billing file" OnClick="btnBillingFile_Click" />
</td>
</tr>
</table>
</radA:RadAjaxPanel>
C# Code :
protected void btnBillingFile_Click(object sender, EventArgs e)
{
string fileTabDelimited = ConfigurationManager.AppSettings["KEY_DOCUMENT_FOLDER"] + @"\Billing Files\BillFile.txt";
FileInfo fileInfo = new FileInfo(fileTabDelimited);
if (fileInfo.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileTabDelimited);
Response.AddHeader("Content-Length", fInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(fileTabDelimited);
//Response.End();
}
}
but not working. This code can not prompt to Open/Save dialog.
please help.
Chandan