一个接一个地更新两个更新面板 [英] Updating two updatepanels one after other

查看:72
本文介绍了一个接一个地更新两个更新面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们. . . . .我的aspx页面中有两个updatepanels. . .每当要更新updatepanel1时,我都想更新updatepanel2. . . . .在这方面有人可以帮助我吗? . . .

Hi friends. . . . . I have two updatepanels in my aspx page. . . I want to update the updatepanel2 whenever the updatepanel1 get updated. . . . . Can anybody help me in this regard. . . .

推荐答案

在第二个更新面板中添加触发器,以从要更新第二个更新面板的第一个更新面板中进行控制.
尝试通过删除触发器&你会明白的.

Add trigger in second update panel for control from first update panel for which you want to update second update panel.
Try this solution with removing trigger & you will get idea.

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    <asp:Label ID="lbl1" runat="server" Text="lbl1"></asp:Label>
    <asp:Button ID="btn" runat="server" onclick="btn_Click" Text="Click" />
    </ContentTemplate>
    </asp:UpdatePanel>

    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
    <Triggers>
    <asp:PostBackTrigger ControlID="btn" />
    </Triggers>
    <ContentTemplate>
    <asp:Label ID="lbl2" runat="server" Text="lbl2"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>





protected void btn_Click(object sender, EventArgs e)
   {
       lbl1.Text = "change1";
       lbl2.Text = "change2";
   }


这篇关于一个接一个地更新两个更新面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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