简体   繁体   English

Visual Studio 2010中中继器内的更新面板不起作用单选按钮

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

I have a radio button inside repeater inside update panel. 我在更新面板的中继器内有一个单选按钮。 When I click on radio button then whole page is reload. 当我单击单选按钮时,将重新加载整个页面。 This same code is working perfectly in Visual Studio 2008 but not working on 2010. 相同的代码在Visual Studio 2008中可以正常运行,但在2010年不能正常运行。

ASPX... ASPX ...

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

Code... 码...

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”

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

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