开发者

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.

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 :

<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.

But it's not: the UpdateMode property of the UpdatePanel has 2 possible values:

  • 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.

When set to Conditional, the UpdatePanel will be updated only on postback originated by controls inside the panel or from the triggers specified.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜