0

我需要帮助。我有一个在单击按钮后触发的进度条。此按钮在 SQL 中运行存储过程,它将更新我稍后为 gridview 绑定的表,在运行存储过程后我执行代码来更新 gridview。问题是,进度条出来后,我预计gridview会自动刷新/更新,但它没有发生。请帮忙。

ASPX - 网格视图:

<asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center">
<asp:UpdatePanel ID="UpdatePanel9" ChildrenAsTriggers="false" UpdateMode="Conditional" runat="server">

                <ContentTemplate>
                    <table cellpadding="0" cellspacing="0">
                        <asp:GridView ID="GridExportExcel" runat="server" >
...........Blah
                    </table>
            </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnExecSP" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
</asp:Panel>

进度条:

<asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="false">
            <ProgressTemplate>
                <asp:Image ID="loading" runat="server" ImageUrl="loading.gif" />
            </ProgressTemplate>
        </asp:UpdateProgress>

按钮后面的代码: - 此存储过程运行大约 3 分钟。

 DataTable dt = new DataTable();
            GridExportExcel.DataSource = dt;
            GridExportExcel.DataBind();

            //UpdatePanel9.Update();

            string connectionString = WebConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString;

            string selectSQL = "exec dbo.StoredPRoc'" + txtcomp.Text + "','" + TextBox2.Text + "'";


            DataTable DT = new DataTable();
            DT = ExecGetData(selectSQL);

            header(); //Update the Gridview.

谢谢你-伦茨


嗨,布赖恩,感谢您的回复。我不允许在表中创建索引。我做了一些工作并删除了进度条,它工作正常,尽管查询/存储过程仍然在 3 分钟内执行。网格视图现在正在更新。如何在不超时的情况下显示进度条?有没有办法做到这一点?我很感激你的回复。提前致谢。

4

1 回答 1

0

It's quite possible that you are timing out, and therefore the new result doesn't come back. To verify this, try binding to a test query that only takes a few seconds to run, and see if the results come back from that. If that is true, then it would be the query.

Are there any efficiencies you can make to the query, like applying indexes, or use an alternative querying approach? 3 minutes is a very long time to run for a web application.

于 2013-05-06T12:18:18.453 回答