AJAX.Net - 的UpdatePanel不会删除旧内容 [英] AJAX.Net - UpdatePanel doesn't delete old content

查看:193
本文介绍了AJAX.Net - 的UpdatePanel不会删除旧内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AJAX.Net(3.5)一个用户控件中。
用户控件包含一个UpdatePanel,而UpdatePanelthere里面是一个多视图。
使用ScriptManager包含在充当该用户控件容器的页

I'm using AJAX.Net (3.5) inside a usercontrol. The usercontrol contains an UpdatePanel, and inside the UpdatePanelthere is a MultiView. The ScriptManager is included in the page that act as container for the usercontrol.

到用户控件包含一个简单的按钮视图之间切换。
当我点击它,查看被改变,旧的内容被隐藏并显示新的内容。
我的问题是,内容未被隐藏的。
视图的变化和新的内容显示出来,但旧的仍然在页面上。
为了找出问题,我试图改变多视点和开关一个简单的标签的知名度,但行为是一样的。
任何想法?

To switch between views the usercontrol contains a simple button. When I click it, the View is changed so the old content is hidden and new content is displayed. My problem is that the content isn't hidden at all. The view changes and the new content is displayed, but the old one remains on the page. To isolate the problem, I tried changing the multiview and switching visibility of a simple label, but the behavior is the same. Any ideas?

推荐答案

看来,如果你有外的UpdatePanel表的一部分AJAX.Net不能很好地工作。

It seems that AJAX.Net doesn't work very well if you have part of a table outside the UpdatePanel.

在我的控制我要显示或隐藏表的某些行。我只包括的 TR 的和的 TD 的的UpdatePanel内标签。

On my control I want to show or hide some rows of a table. I included only the tr and td tags inside the updatepanel.

要重现该问题:

<table>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
    <ContentTemplate>
        <tr>
            <td>
                <asp:Label ID="lblToShow" runat="server" Text="Label to show" Visible="false" />
                <br />
                <asp:Label ID="lblToHide" runat="server" Text="Label to hide" />
            </td>
        </tr>
    </ContentTemplate>
</asp:UpdatePanel>
</table>

如果您使用更改能见度:

If you change the visibility using:

lblToShow.Visible = true;
lblToHide.Visible = false;

这两个标签的文字显示在页面上(lblToHide不隐藏)

The text of both labels are shown on the page (lblToHide does not hide)

如果您移动的的标签 UpdatePanel的一切工作正常。

If you move the table tags inside the UpdatePanel everything works fine.

这篇关于AJAX.Net - 的UpdatePanel不会删除旧内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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