简体   繁体   English

“更新面板”控件出现问题

[英]Problem with “Update panel” control

i am using ASP.NET in which i am using Ajaxcontroltoolkit and "update panel" control for update part of the page. 我正在使用ASP.NET,其中我正在使用Ajaxcontroltoolkit和“更新面板”控件来更新页面的一部分。
it works fine first time when i run the program, but from second time the "update panel" control doesn't work. 第一次运行该程序时,它运行良好,但是第二次,“更新面板”控件不起作用。 i can give more details about it, any idea what is the problem? 我可以提供更多详细信息,知道是什么问题吗?

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table border="1" id="tbRegistration" style="font-family: Calibri" width="800px">
                    <tr>
                        <td style="width: 33%" align="center">
                            <asp:RadioButton ID="rbIndividual" runat="server" OnCheckedChanged="RadioButton_CheckedChanged"
                                Text="Individual" GroupName="Profile" AutoPostBack="true" />
                        </td>
                        <td style="width: 33%" align="center">
                            <asp:RadioButton ID="rbAgent" runat="server" OnCheckedChanged="RadioButton_CheckedChanged"
                                Text="Agent" GroupName="Profile" AutoPostBack="true" />
                        </td>
                        <td style="width: 33%" align="center">
                            <asp:RadioButton ID="rbBuilder" runat="server" OnCheckedChanged="RadioButton_CheckedChanged"
                                Text="Builder" GroupName="Profile" AutoPostBack="true" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>

i think you have to use update panel in this way: 我认为您必须以这种方式使用更新面板:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

 </asp:UpdatePanel>

if UpdateMode does't solve your problem try to use this : 如果UpdateMode无法解决您的问题,请尝试使用此方法:

<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" ChildrenAsTriggers="false"  runat="server">

</asp:UpdatePanel>

Since the cool thing about the ASP.NET Ajax UpdatePanel is that its contents are updated asynchronously when an event that would normally generate a postback is raised inside, one would think that this is its default behavior. 因为关于ASP.NET Ajax UpdatePanel的很酷的事情是,当内部引发通常会产生回发事件的事件时,异步地更新其内容,所以人们会认为这是其默认行为。

But it's not: the UpdateMode property of the UpdatePanel has 2 possible values: 但这不是:UpdatePanel的UpdateMode属性具有2个可能的值:

  • Always 总是
  • Conditional 有条件的

and the default value is Always. 且默认值为始终。

When set to Always, the UpdatePanel is updated on every postback raised from anywhere in the page, so from controls inside the panel, inside other panels or just on the page. 设置为“始终”时,UpdatePanel会在页面上任何位置引发的每次回发中更新,因此会从面板内部,其他面板内部或页面上的控件进行更新。

When set to Conditional, the UpdatePanel will be updated only on postback originated by controls inside the panel or from the triggers specified. 当设置为“条件”时,UpdatePanel仅在由面板内的控件或指定的触发器发起的回发时进行更新。

So, if you have multiple update panels and you don't want to update all of them to be updated every time, you have to set the UpdateMode to Conditional 因此,如果您有多个更新面板,并且不想每次都更新所有要更新的面板,则必须将UpdateMode设置为Conditional

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM