我想在我的 gridview 填充数据时在我的 asp.net 网页中显示一个加载指示器
这是我的 aspx 页面的一部分
<script type="text/javascript" src="Scripts/jsUpdateProgress.js"></script>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Panel ID="panelUpdateProgress" runat="server" CssClass="updateProgress">
<asp:UpdateProgress ID="UpdateProg1" DisplayAfter="0" runat="server">
<ProgressTemplate>
<div style="position: relative; top: 30%; text-align: center;">
<img src="Styles/images/loading.gif" style="vertical-align: middle" alt="Processing" />
Loading...
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalProgress" runat="server" TargetControlID="panelUpdateProgress"
BackgroundCssClass="modalBackground" PopupControlID="panelUpdateProgress" />
(我的代码基于这个示例 weblogs.asp.net/blogs/guillermo/Code/modalExample.zip)
这是我调用我的方法的按钮
<asp:UpdatePanel ID="updatePanel" runat="server">
<ContentTemplate>
<asp:Button ID="btMonth" runat="server" onclick="btMonth_Click" Text="Ver" />
</ContentTemplate>
</asp:UpdatePanel>
这是我的方法 btMonth_Click 的 c# 代码
protected void btMonth_Click(object sender, EventArgs e)
{
string query = "select * from table";
SqlDataSource1.SelectCommand = query;
gInd.DataSourceID = "SqlDataSource1";
}
正如您所看到的,当“加载”指示器出现时,我想填充一个 GridView,但是当我单击按钮时,会调用方法 btMonth_Click,该方法被执行,但我的 gridview 没有被填充。如果我删除我的按钮的 asp:UpdatePanel 我的 gridview 填充得很好
有什么我想念的吗?