Hi I've a little problem when I show a button from an Ajaxified control and then I use the button to download a file, I've also tried to register the control but it won't work..
this is the code:
this is the code:
<asp:ScriptManager ID="ScriptManager1" runat="server"> |
</asp:ScriptManager> |
<div> |
<asp:Button ID="Button1" runat="server" Text="Show" /> |
<asp:Button ID="Button2" runat="server" Text="Download" Visible="false" /> |
</div> |
<telerik:radajaxmanager ID="Radajaxmanager1" runat="server" > |
<AjaxSettings> |
<Telerik:AjaxSetting AjaxControlID="Button1"> |
<UpdatedControls> |
<Telerik:AjaxUpdatedControl ControlID="Button2" /> |
</UpdatedControls> |
</Telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:radajaxmanager> |
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click |
Button2.Visible = True |
ScriptManager1.RegisterPostBackControl(Button2) |
End Sub |
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click |
Dim fi As New System.IO.FileInfo("C:\test.zip") |
If fi.Exists Then |
HttpContext.Current.Response.Buffer = True |
HttpContext.Current.Response.ClearContent() |
HttpContext.Current.Response.ClearHeaders() |
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name) |
HttpContext.Current.Response.ContentType = "application/download" |
HttpContext.Current.Response.AddHeader("Content-Length", fi.Length) |
HttpContext.Current.Response.WriteFile(fi.FullName) |
HttpContext.Current.Response.End() |
HttpContext.Current.Response.Flush() |
End If |
End Sub |