ASP.net Gridview Autoupdate

时间:2018-05-04 03:22:37

标签: c# jquery asp.net asp.net-ajax

我有gridview,如下所示。

<asp:GridView ID="grdPrintData" runat="server" AutoGenerateColumns="False" CssClass="GridViewStyle"
                            Width="100%">
                            <AlternatingRowStyle BackColor="#B6C4DE"></AlternatingRowStyle>
                            <Columns>
                                <asp:BoundField DataField="S No" HeaderText="S No" SortExpression="S No">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Object ID" HeaderText="Object ID" SortExpression="Object ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Object Description" HeaderText="Object Description" SortExpression="Object Description">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Print Count" HeaderText="Print Count" SortExpression="Print Count">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField Visible="false">
                                    <ItemTemplate>
                                        <asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading-gif-transparent-10.gif" Height="15px" Width="30px" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle CssClass="HeaderStyle" />
                            <FooterStyle CssClass="FooterStyle" />
                            <RowStyle CssClass="RowStyle" />
                            <AlternatingRowStyle CssClass="AlternatingRowStyle" />
                            <PagerStyle CssClass="PagerStyle" />
                        </asp:GridView>

此gridview位于UpdatPanel内。

 <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
                <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: black; opacity: 9.5;">
                    <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/loader.gif" AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 5px; position: fixed; top: 35%; left: 43%;" BackColor="Black" />
                    <asp:Label runat="server" Text="Trying to connecto to printer...Please Wait..." ID="lblLoadMessage" Style="padding: 10px; position: fixed; top: 33%; left: 43%;" Font-Bold="true" Font-Size="Larger"></asp:Label>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>

如果在触发每个打印命令并完成打印后更改以下标记中的图像。

<asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading-gif-transparent-10.gif" Height="15px" Width="30px" />

就像,最后的网格视图列显示加载符号,一旦打印特定行,必须将图像更改为完成。

1 个答案:

答案 0 :(得分:0)

你可以在这里使用两个按钮,如果打印成功,则将可见false设置为第一个按钮,将true设置为第二个按钮。