I've a webform wich present a pop-up with a confirmation button :
<div id="Popup" class="modal hide">
<asp:Panel ID="MyPanel" runat="server">
<asp:UpdatePanel ID="UpdatePanelPopup" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="ButtonConfirmerPopup" />
</Triggers>
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3 id="PopupTitle" runat="server">
<asp:Label runat="server" ID="LibelleTitrePopup"></asp:Label></h3>
</div>
....
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Annuler</a>
<asp:Button ID="ButtonConfirmerPopup" ValidationGroup="Submit" runat="server" OnClick="ButtonConfirmerPopup_Click"
CssClass="btn btn-success" Text="Confirmer" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</div>
The click button executes :
protected void ButtonConfirmerPopup_Click(object sender, EventArgs e)
{
int idPart = Convert.ToInt32(HiddenFieldIdStagiairePopup.Value);
if (Convert.ToBoolean(HiddenFieldIsValidationPopup.Value))
{
bool result = Valider(idPart);
if (!result)
return;
GetZipDocumentFormation();
Bootstrap.Message(MessageContainer, "Inscription validée", "alert-success");
BindListPart();
UpdatePanelGrid.Update();
MyPanel.Visible = false;
}
else
Refuser(idPart);
ButtonConfirmerPopup.Attributes.Remove("data-dismiss");
}
And the ZIP file creation (using ICSharpCode.SharpZipLib.Zip):
private void GetZipDocumentFormation()
{
if (ViewState["DocumentsFormation"] == null)
return;
var pjs = (List<string>)ViewState["DocumentsFormation"];
ViewState["DocumentsFormation"] = null;
// envoi des fichiers en ZIP
const string fileName = "documents_formation.zip";
string root = Server.MapPath("~/Resources/");
Zip.ZipFiles(pjs, string.Format("{0}\\{1}", root, fileName));
//HttpResponse response = HttpContext.Current.Response;
//response.ClearContent();
//response.Clear();
//response.ContentType = "text/plain";
//response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
//response.TransmitFile(string.Format("{0}\\{1}", root, fileName));
//response.Flush();
Response.AppendHeader("content-disposition", "attachment; filename=" + fileName);
Response.ContentType = "application/zip";
Response.WriteFile(string.Format("{0}\\{1}", root, fileName));
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
The zip creation is OK, i get the file. But the pop-up is always displayed and the UpdatePanel is not updated. If I don't execute zip file creation, everything is OK.
Could you please purpose me help ?
Regards.