簡體   English   中英

Visual Studio 2010中中繼器內的更新面板不起作用單選按鈕

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

我在更新面板的中繼器內有一個單選按鈕。 當我單擊單選按鈕時,將重新加載整個頁面。 相同的代碼在Visual Studio 2008中可以正常運行,但在2010年不能正常運行。

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>

碼...

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