Updateprogress is not working when click Export Button
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MasterModel.aspx.cs" Inherits="MasterModel" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="TimePicker" Namespace="MKB.TimePicker" TagPrefix="Tpc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<title>Model Entry</title>
<%-- ============================ Start Script ====================================== --%>
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no" />
<link href="../Styles/DefineCss1.css" rel="stylesheet" />
<link href="../Style/GridViewStyleNew.css" rel="stylesheet" />
<%-- Start Sweet Alert --%>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<%-- End Sweet Alert --%>
<%-- Start Date --%>
<link type="text/css" href="../Scripts/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script src="../Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../Scripts/jquery-ui-1.8.19.custom.min.js"></script>
<%-- End Date --%>
<%-- Start GridView Scroll --%>
<script src="../GridViewScrollBothSide/jquery-1.9.1.min.js"></script>
<script src="../GridViewScrollBothSide/JavaScript.js"></script>
<script src="../GridViewScrollBothSide/GridViewScrollBothSide.js"></script>
<%-- End Grid View Script --%>
<%-- Start ListBox Sumo Select --%>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/5.3.2/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.sumoselect/3.4.9/jquery.sumoselect.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.sumoselect/3.4.9/sumoselect.min.css" rel="stylesheet" />
<%-- End ListBox Sumo Select --%>
<%-- ============================ End Script ====================================== --%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:HiddenField ID="HiddenFieldClientTime" runat="server" />
<%-- <div class="LoadingModal" align="center">
Please wait being process. <br />
<br />
<img src="../Loader/loadermodal.gif" />
</div>--%>
<%-- New Loader --%>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class=" modalnew">
<div class="centernew">
<img alt="" src="Loader/loadermodal.gif" alt="Loading...." />
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<%-- End New Loader --%>
<%-- ======================== Start Session Time Out ============================================= --%>
<div>
<asp:LinkButton ID="lnkFake" runat="server" />
<cc1:ModalPopupExtender ID="mpeTimeout" BehaviorID="mpeTimeout" runat="server" PopupControlID="pnlPopup"
TargetControlID="lnkFake" CancelControlID="btnNo" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup bg-info" Style="display: none">
<div class="header">
Session Expiring!
</div>
<div class="body">
Your Session will expire in <span id="seconds"></span> seconds.<br />
Do you want to continue your work?
</div>
<br />
<div class="footer" align="right">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="btnYes" runat="server" Text="Yes" CssClass="btn btn-success" OnClick="ResetSession" />
<asp:Button ID="btnNo" runat="server" Text="No" CssClass="btn btn-danger" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnNo" />
</Triggers>
</asp:UpdatePanel>
</div>
</asp:Panel>
</div>
<%-- ====================== End Script For Session =================== --%>
</asp:Content>
protected void ExportReport()
{
string NewEntry = "Entry By : " +
TxtUserId.Text.Trim() + "-" +
TxtUserName.Text.Trim() + " " + DateTime.Now.Date.ToString("dd-MM-yyyy") + " " + TransactionTime;
UserIdandName = TxtUserId.Text.Trim().ToUpper() + "-" + TxtUserName.Text.Trim().ToUpper();
int MainCompanyCodeTmp = int.Parse(TxtUserCompanyCode.Text);
int MainBranchCodeTmp = int.Parse(TxtUserBranchCode.Text);
int UserIdTmp = int.Parse(TxtUserId.Text);
string UserNameTmp = TxtUserName.Text.Trim().ToUpper();
// SET DATABASE CONNECTION.
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
SqlDt = new DataTable();
SqlCm = new SqlCommand("ModelList", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
SqlCm.Parameters.AddWithValue("ModelName", "NA");
SqlCm.Parameters.AddWithValue("MainCompanyCode", MainCompanyCodeTmp);
SqlCm.Parameters.AddWithValue("SearchType", "EXPORTLIST");
SqlDa = new SqlDataAdapter(SqlCm);
SqlDa.Fill(SqlDt);
dg.DataSource = SqlDt;
dg.DataBind();
if (dg.Rows.Count == 0)
{
MessageTitle = "No Record Found";
MessageSwalTitle = "Oops !!!";
MessageSwalDisplay = MessageTitle;
MessageSwalType = "warning"; // info , success , warning , error
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "FunctionAlertMessage('" + MessageSwalTitle + "', '" + MessageSwalDisplay + "', '" + MessageSwalType + "');", true);
return;
}
string sFileName = "ModalList_" + System.DateTime.Now + ".xls";
sFileName = sFileName.Replace("/", "");
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=" + sFileName);
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
using (StringWriter sw = new StringWriter())
{
HtmlTextWriter hw = new HtmlTextWriter(sw);
//To Export all pages
dg.AllowPaging = false;
dg.HeaderRow.BackColor = Color.White;
foreach (TableCell cell in dg.HeaderRow.Cells)
{
cell.ForeColor = Color.Black;
cell.Font.Bold = true;
cell.Font.Size = 10;
cell.BackColor = Color.LightCyan;
}
foreach (GridViewRow row in dg.Rows)
{
row.BackColor = Color.White;
foreach (TableCell cell in row.Cells)
{
if (row.RowIndex % 2 == 0)
{
cell.BackColor = dg.AlternatingRowStyle.BackColor;
}
else
{
cell.BackColor = dg.RowStyle.BackColor;
}
}
}
string ReportTitle = "<table> " +
"<tr>" +
" <td colspan='12' style='background-color:lightyellow ; border:solid;text-align:center;font-size:50px;color:darkblue '><b>" + "Model List".ToUpper() + "</b></td>" +
"</tr>" +
"<tr>" +
" <td style='background-color:lightyellow; border:solid '><b>" + "Report Date" + "</b></td>" +
" <td colspan='11' style='background-color:lightyellow;text-align:left; border:solid '><b>" + System.DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss") + "</b></td>" +
"</tr>" +
"<tr>" +
" <td style='background-color:lightyellow; border:solid '><b>" + "Company Name" + "</b></td>" +
" <td colspan='11' style='background-color:lightyellow; border:solid '><b>" + TxtUserCompanyName.Text + "</b></td>" +
"</tr>" +
"</table>";
// ADD A ROW AT THE END OF THE SHEET SHOWING A RUNNING TOTAL OF PRICE.
Response.Write(ReportTitle);
//Response.Write(ReportCompany);
//Response.Write(ReportDateRange);
//Response.Write(ReportDate);
dg.RenderControl(hw);
//Convert to number
//Response.Write("<style> TD { mso-number-format:\@; } </style>");
//style to format numbers to string
string style = @"<style> .textmode { mso-number-format:\@; } </style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
}
}