0

我有一个 asp.net 控件(.net 3.5),它对 web 服务进行一系列调用以从数据库中获取数据,然后将其放入 gridviews 中。由于每个数据库查询需要几秒钟的时间,我会在一系列调用中而不是一次性完成,否则它会超时。

在返回所有数据之前,该页面似乎不会呈现。我如何在每次调用时向用户显示进度,以让他们确信某些事情正在实际发生?

网格包含财务数据。用户选择月份和年份,然后按下一个按钮,启动这个 web 服务调用序列。所以这通常发生在回发中(尽管页面最初呈现的是当前月份和年份的数据,如果有的话)。

我遇到过UpdatePanel。这会使每个表格在填充数据时呈现吗?

编辑:这是我到目前为止使用 Sunny 的建议所做的尝试

.ascx 文件

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
    <ProgressTemplate>
      UpdatePanel1 updating...
    </ProgressTemplate>
    </asp:UpdateProgress>
<asp:UpdateProgress ID="UpdateProgress2" AssociatedUpdatePanelID="UpdatePanel2" runat="server">
    <ProgressTemplate>
      UpdatePanel2 updating...
    </ProgressTemplate>
    </asp:UpdateProgress>

<asp:Label runat="server" ID="lblOB"></asp:Label><asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <contenttemplate>
<h3><asp:Label runat="server" ID="lblT1"></asp:Label></h3>
<asp:GridView runat="server" id="gridT1">
</asp:GridView>

    </contenttemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <contenttemplate>
<h3><asp:Label runat="server" ID="lblT2"></asp:Label></h3>
<asp:GridView runat="server" id="gridT2">
<Columns>
    </Columns>
    </asp:GridView>
    </contenttemplate>
</asp:UpdatePanel>

.ascx.vb 文件:

 (Pseudo code)
 Call webservice for table 1
 gridT1.datasource = table 1 data from webserivce
 gridT1.DataBind()
 lblT1.text = heading

 Call webservice for table 2
 gridT2.datasource = tabld 2 data from webserivce
 gridT2.DataBind()
 lblT12text = heading
4

1 回答 1

0

使用可以在这里使用 Ajax 加载器或 UpdateProgress Ajax 控件。

于 2012-06-13T08:29:00.510 回答