Cannot Download file in UpdatePanel
The accepted answer is just plain wrong. You need to register the control with the scriptmanager. Mine is in the master page and here is the code i use to register any button for proper post backs.
private void MasterPageRegisterButtonForPostBack(Control bt)
{
MasterPage masterPage = Master;
if (masterPage is MainMaster)
{
var mainMaster = masterPage as MainMaster;
if (bt != null && mainMaster.MasterScriptManager != null)
{
mainMaster.MasterScriptManager.RegisterPostBackControl(bt);
}
}
}
I got it working the following way:
inside my Update Panel I configured the controls that may forece a full postback in order to get the download working.
(I'm using also Master pages,this is the same solution as Steve's but registering it in the aspx and not in code behind)
<asp:UpdatePanel runat="server" ID="UpdatePanelDownload" UpdateMode="Conditional" ChildrenAsTriggers="True">
<ContentTemplate>
<asp:LinkButton ID="LinkButtonDownload" OnClick="Download_Click" runat="Server">Save XML</asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LinkButtonDownlod" />
</Triggers>
</asp:UpdatePanel>