如何在单选按钮列表中添加复选框元素

时间:2018-10-03 19:27:38

标签: asp.net

我的代码看起来像这样:

<asp:RadioButtonList>
  <asp:ListItem></asp:ListItem>
  <asp:ListItem></asp:ListItem> //ToDo
  <asp:ListItem></asp:ListItem>
</asp:RadioButtonList>

我想在选择第二个列表项后显示<asp:CheckBox>元素。 因此,该复选框需要出现在第二个和第三个列表项之间。反正有这样做吗? 现在,我在单选按钮列表元素后面显示复选框。

1 个答案:

答案 0 :(得分:0)

使用df <- structure(list(Entry = structure(c(2L, 1L, 3L), .Label = c("Cat", "Dog", "human"), class = "factor"), String = structure(c(1L, 3L, 2L), .Label = c("cube;funny;smart", "man;women", "tiny;cube;black" ), class = "factor")), row.names = c(NA, 3L), class = "data.frame") Sim <- function(x, y){ # example since I don't have real Sim set.seed(sum(nchar(x) + nchar(y))) runif(1) } 是不可能的。您将必须使用带有RadioButtonList的单个RadioButton来创建自己的RadioButton。

GroupName

更新

这很可能是骇人听闻的。并且是否有用取决于您要对该复选框执行的操作。 将ListItem的<asp:RadioButton ID="RadioButton1" runat="server" GroupName="MyGroup" /> <asp:CheckBox ID="CheckBox1" runat="server" /> <asp:RadioButton ID="RadioButton2" runat="server" GroupName="MyGroup" /> <asp:RadioButton ID="RadioButton3" runat="server" GroupName="MyGroup" /> 设置为html复选框。

Text

然后将其移到单选按钮上

RadioButtonList1.Items[1].Text = "<input type=\"checkbox\" id=\"checkBoxInsideList\" class=\"RadioButtonListWithCheckbox\">";