使用单选按钮 SelectedIndexChanged 触发 updatePanel

发布于 2024-09-10 05:44:31 字数 1959 浏览 1 评论 0原文

我有一个单选按钮列表(带有 2 个 rdb)和一个检查列表(7 个 ckb)。我希望仅当用户选择选中第二个单选按钮时才显示复选框列表。

我以前从未使用过 AJAX。

我的实际代码(是的,它们在表格内):

<td>

                    <asp:Label ID="Label7" runat="server" Font-Bold="True">Frequency</asp:Label>
                    <table>
                        <tr>
                            <td>
                                <asp:RadioButtonList ID="rdbDaysList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="rdbDaysList_SelectedIndexChanged"
                                    RepeatColumns="2" CausesValidation="True">
                                    <asp:ListItem>Daily</asp:ListItem>
                                    <asp:ListItem>Weekly</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                <asp:CheckBoxList ID="ckbList" runat="server" Visible="false" RepeatColumns="5" RepeatDirection="Horizontal">
                                    <asp:ListItem>Monday</asp:ListItem>
                                    <asp:ListItem>Tuesday</asp:ListItem>
                                    <asp:ListItem>Wednesday</asp:ListItem>
                                    <asp:ListItem>Thursday</asp:ListItem>
                                    <asp:ListItem>Friday</asp:ListItem>
                                    <asp:ListItem>Saturday</asp:ListItem>
                                    <asp:ListItem>Sunday</asp:ListItem>
                                </asp:CheckBoxList>
                            </td>
                        </tr>
                    </table>
</td>

提前致谢!

I have a radiobutton list (With 2 rdb) and a check list (7 ckb). I would like the checkbox list appears only when the user selects the second radio button is checked.

I never used AJAX before.

My actual code (yes, they are inside a table):

<td>

                    <asp:Label ID="Label7" runat="server" Font-Bold="True">Frequency</asp:Label>
                    <table>
                        <tr>
                            <td>
                                <asp:RadioButtonList ID="rdbDaysList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="rdbDaysList_SelectedIndexChanged"
                                    RepeatColumns="2" CausesValidation="True">
                                    <asp:ListItem>Daily</asp:ListItem>
                                    <asp:ListItem>Weekly</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                <asp:CheckBoxList ID="ckbList" runat="server" Visible="false" RepeatColumns="5" RepeatDirection="Horizontal">
                                    <asp:ListItem>Monday</asp:ListItem>
                                    <asp:ListItem>Tuesday</asp:ListItem>
                                    <asp:ListItem>Wednesday</asp:ListItem>
                                    <asp:ListItem>Thursday</asp:ListItem>
                                    <asp:ListItem>Friday</asp:ListItem>
                                    <asp:ListItem>Saturday</asp:ListItem>
                                    <asp:ListItem>Sunday</asp:ListItem>
                                </asp:CheckBoxList>
                            </td>
                        </tr>
                    </table>
</td>

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

习惯成性 2024-09-17 05:44:31

确保 RadioButtonList autoPostback = true

make sure the RadioButtonList autoPostback = true

箜明 2024-09-17 05:44:31

您需要使用 UpdatePanel 控件包围单选按钮和复选框列表。然后在单选按钮控件的 OnSelectIndexChanged 事件中,将复选框列表的 Visible 属性设置为 true。

You'll need to surround the radion button and check box list with an UpdatePanel control. Then in the OnSelectIndexChanged event on the radio button control, set the Visible property of then check box list to true.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文