跨越 6 个 DIVS 的 RadioButtonList

发布于 2024-11-25 04:43:53 字数 620 浏览 4 评论 0原文

关于 类的问题。我有一个 2 行、3 列的 DIV 设置,带有单选按钮选项,如下所示:

() Option 1  |  () Option 2 | () Option 3
-----------------------------------------
() Option 4  |  () Option 5 | () Option 6

原因是当用户选择不同的选项时,附加信息将通过 jQuery 显示,但我希望所有选项都绑定到 1 个列表,以便在选择选项 1 时没有别的,当选择选项 5 时,它会取消选择选项 1。基本 RadioButtonList 类型的东西。

唉,从我读过/破解的内容来看,使用 asp:RBL 类,您无法在标签之间输入任何 html 或其他代码。

关于如何做到这一点有什么想法吗?如果我保持 ID 相同,则会出错,表示该列表已存在...

感谢您的指点。

编辑:

我相信我找到了解决方案。我没有使用 RadioButtonList,而是使用 RadioButton 并实现了 GroupName 选项将它们绑定在一起。看起来现在正在工作。

Question about the <asp:RadioButtonList> class. I have a 2 row, 3 column DIV setup with Radio Button options like this:

() Option 1  |  () Option 2 | () Option 3
-----------------------------------------
() Option 4  |  () Option 5 | () Option 6

Reason being is that when users select different options additional info will be displayed via jQuery but I want all the options tied to 1 list so that when Option 1 is selected nothing else is and when Option 5 is selected it deselects Option 1. Basic RadioButtonList type of stuff.

Alas from what I've read/hacked is that with the asp:RBL class you can't enter any html or other code between the tags.

Any thoughts on how to do this? If I keep the ID the same it errors out saying that list already exists...

Thanks for any pointers.

Edit:

I believe I found the solution. Instead of using a RadioButtonList I just used RadioButton and implemented the GroupName option to bind them together. Looks like it's working now.

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

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

发布评论

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

评论(1

沩ん囻菔务 2024-12-02 04:43:53

您有几个选择:

  • 使用具有 GroupName 属性的多个 RadioButton(如您所提到的),
  • 如果您确实想继续使用 RadioButtonList,则稍后使用 JavaScript 操作它们,
  • 使用 HTML 单选按钮并手动绑定它们,

我建议使用第一个选项,因为它是最简单的稳健性、功能和简单性的平衡。

You have a few choices:

  • use multiple RadioButtons with the GroupName attribute (as you mentioned)
  • manipulate them later with JavaScript if you really want to keep using the RadioButtonList
  • use HTML radio buttons and bind them manually

I suggest the first option as it is the simplest balance of robustness, power, and simplicity.

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