更新面板在 visual studio 2010 中中继器内的单选按钮不起作用

Update panel not working radio button inside repeater in visual studio 2010

我在更新面板内的中继器内有一个单选按钮。当我单击单选按钮时,整个页面将重新加载。同样的代码在 Visual Studio 2008 年运行良好,但在 2010 年无法运行。

A​​SPX...

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
        <fieldset>
            <div class="row" id="divSize" runat="server">
                <label class="label col col-2">Size</label>
                <section class="col col-10">
                    <div id="divMultisize" runat="server" class="inline-group row" >
                        <asp:Repeater ID="rptSizeType" runat="server" OnItemDataBound="rptSizeType_OnItemDataBound">
                            <ItemTemplate>
                                <section class="col col-12">
                                    <asp:RadioButton ID="rbSize" GroupName="size" runat="server" AutoPostBack="true" Text='<%# Eval("SizeType")%>' class="radiobtn" OnCheckedChanged="rbSizeType_CheckedChanged" ></asp:RadioButton>
                                    <asp:Label ID="lblSizeTypeID" runat="server" Visible="false" Text='<%# Eval("SizeTypeID")%>'></asp:Label>
                              </section>
                            </ItemTemplate>
                        </asp:Repeater>
                        <div class="clearfix"></div>
                        <asp:Repeater ID="rptSize" runat="server">
                            <ItemTemplate>
                                <section class="col col-4">
                                    <label class="checkbox" style="margin-right:0; min-width:0;">
                                        <asp:CheckBox ID="chkSize" runat="server" onclick = "Disable(this)"></asp:CheckBox>
                                        <i></i><asp:Label ID="lblSize" runat="server" Text='<%# Eval("Size") %>'></asp:Label>
                                    </label>
                                    <section class="col col-8">
                                        <label class="input" id="lblQuantity" runat="server">
                                              <asp:TextBox ID="txtQuantity" runat="server" placeholder="Quantity"></asp:TextBox>
                                        </label>
                                    </section>
                                </section>
                            </ItemTemplate>
                        </asp:Repeater>
                        <div class="clearfix"></div>
                    </div>
                </section>
            </div>
        </fieldset>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="rptSizeType" />
    </Triggers>
</asp:UpdatePanel>

代码...

protected void rptSizeType_OnItemDataBound(object sender, RepeaterItemEventArgs e)
{
        // Code for bind rptSizeType
}

protected void rbSizeType_CheckedChanged(object sender, EventArgs e)
{
        // Code for bind rptSize
}

我找到了解决方案 只需在使用 .net 4.0 时输入 ClientIDMode="AutoID"