ASP.NET:阿贾克斯的UpdatePanel问题 [英] ASP.NET: Ajax UpdatePanel Issue

查看:107
本文介绍了ASP.NET:阿贾克斯的UpdatePanel问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该更新进度和放大器;显示在客户端相应的信息,而该功能仍在执行在服务器端。

I am supposed to update the progress & display the corresponding message on the client side while the function is still under execution at server side.

我怎样才能做到这一点?

How can I achieve this?

功能如下:

protected void Button1_Click(object sender, EventArgs e)
        {
            string Result = "Success";
            if (Result == "Success")
            {
                Label1.Text = "Plan mst Completed";
                Thread.Sleep(2000);     //Some functionality here
                Label1.Text = "Packing date mst Started";
            }
            if (Result == "Success")
            {
                Label1.Text = "Packing date mst Completed";
                Thread.Sleep(2000);     //Some functionality here
                Label1.Text = "Etd mst Started";
            }

            if (Result == "Success")
            {

                Label1.Text = "Etd mst Completed";
                Thread.Sleep(2000);     //Some functionality here
                Label1.Text = "Inner box mst Started";

            }
        }

和我有,而上述功能仍在执行更新的Label1文本。

And I have to update the text of Label1 while the above function is still under execution.

我已经使用AJAX(虽然我还是个初学者)试过,但没有成功。下面是我所做的:

I have tried using AJAX(although I'm still a beginner), but with no success. Here's what I did:

<form id="form1" runat="server">
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Timer ID="Timer1" runat="server" Interval="10" ontick="Timer1_Tick1">
            </asp:Timer>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        </ContentTemplate>
    </asp:UpdatePanel>
    </form>

和相应的事件:

protected void Page_Load(object sender, EventArgs e)
        {
            UpdatePanel1.UpdateMode = UpdatePanelUpdateMode.Conditional;
        }
        protected void Timer1_Tick1(object sender, EventArgs e)
        {
            UpdatePanel1.Update();            
        }

如通过jQuery或以其他方式比其他AJAX任何其他的替代品也欢迎...
请尽快帮忙。

Any other alternatives other than AJAX such as via jQuery or otherwise are also welcome... Please help asap.

推荐答案

这可能会帮助您:

http://forums.asp.net/t/1500201.aspx

ASP.NET异步更新标签

这篇关于ASP.NET:阿贾克斯的UpdatePanel问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆