小编Dan*_* H.的帖子

在处理循环期间更新ASP.NET UpdatePanel

我已经多次看到这个特殊问题,但我见过的解决方案都没有实现我想做的事情.

我有一个带有UpdatePanel的ASP.NET页面.在UpdatePanel中是一个按钮和一个多行文本框.按钮的单击事件禁用该按钮并进入一个处理循环,该循环多次更新TextBox的Text属性.但是,当然,在循环完成之前,TextBox实际上并未更新.

我已经看到了向页面添加Timer控件的建议,我试过了.但是Timer的Tick在循环完成之前不会触发,所以没用!

任何人都有这方面的工作解决方案吗?我需要一个页面,允许用户单击按钮以启动处理数据库中多个记录的进程,并向用户发出更新,指示处理的每个记录.

这是我的页面代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <br />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
            <ContentTemplate>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                <br />
                <asp:TextBox ID="TextBox1" runat="server" Height="230px" TextMode="MultiLine" 
                    Width="800px"></asp:TextBox>
            </ContentTemplate>
        </asp:UpdatePanel>

    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是我的代码隐藏:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UpdatePanel
{
    public partial class Default : System.Web.UI.Page
    {
        protected void …
Run Code Online (Sandbox Code Playgroud)

c# asp.net updatepanel

3
推荐指数
1
解决办法
4325
查看次数

标签 统计

asp.net ×1

c# ×1

updatepanel ×1