I am trying to show a progress bar while printing some documents. But when I click the print button, the progress bar does not show.
here is my code in UI:
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-CssClass="col-md-6">
<ItemTemplate>
<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="upCommands" ID="uProgress">
<ProgressTemplate>
<asp:Panel runat="server" ID="pnlLoader" Visible="true">
<div class="progress" style="height: 20px">
<div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuenow="73" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">
<h4 style="font-size: 12px; font-weight: bold; color: white; margin: auto">Printing...</h4>
</div>
</div>
</asp:Panel>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" ID="upCommands">
<ContentTemplate>
<asp:Panel runat="server" ID="pnlCommands" Visible="true">
<%--<a href="BIS_Edit.aspx?BuyerID=<%# Eval("BuyerID")%> &TransCode=<%# Eval("TransactionCode") %> &BuyerType=<%# Eval("BuyerType") %>" class="btn btn-success btn-xs waves-effect waves-light" id="cmdModifyBIS"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>Modify BIS</a>--%>
<asp:LinkButton runat="server" CssClass="btn btn-success btn-xs waves-effect waves-light" CommandArgument='<%# Eval("BuyerID") + "_" + Eval("TransactionCode") + "_" + Eval("BuyerType") %>' CommandName="ModifyBIS" ID="cmdModifyBIS"><i class="fa fa-pencil-square-o" aria-hidden="true" ></i> Modify BIS</asp:LinkButton>
<asp:LinkButton runat="server" CssClass="btn btn-info btn-xs waves-effect waves-light" CommandArgument='<%# Eval("BuyerID") + "_" + Eval("TransactionCode") + "_" + Eval("BuyerType") %>' CommandName="PrintBIS" ID="cmdPrintBIS" ClientIDMode="Static"><i class="fa fa-print" aria-hidden="true"></i> Print BIS</asp:LinkButton>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
Code Behind:
protected void gvInformationSheets_RowCommand(object sender, GridViewCommandEventArgs e)
{
BuyerCode = e.CommandArgument.ToString().Split('_')[0];
TransactionCode = e.CommandArgument.ToString().Split('_')[1];
BuyerType = e.CommandArgument.ToString().Split('_')[2];
if (e.CommandName == "PrintBIS")
{
if (isPrinting == false)
{
isPrinting = true;
DisablePrinting(BuyerCode, false);
PrintBIS(BuyerCode, TransactionCode, BuyerType);
}
else
{
ShowToastr(this.Page, "Printing in progress, Please wait.", "Information", "info");
}
}
else if (e.CommandName == "ModifyBIS")
{
Response.Redirect("BIS_Edit.aspx?BuyerID=" + BuyerCode + "&TransCode=" + TransactionCode + "&BuyerType=" + BuyerType);
}
}
private void DisablePrinting(string BIS_ID, bool Visible)
{
string buyerIDinRow = "";
foreach (GridViewRow row in gvInformationSheets.Rows)
{
buyerIDinRow = row.Cells[0].Text;
if (buyerIDinRow == BIS_ID)
{
Panel pnlCommand = row.FindControl("pnlCommands") as Panel;
// Panel pnlLoader = row.FindControl("pnlLoader") as Panel;
pnlCommand.Visible = Visible;
//pnlLoader.Visible = !Visible;
}
}
}
How can I show the progress bar when I click the Print Button and Hide it when the processing of printing is done?