行 循环出多个radiobutton的单选问题
<tr>
<td align="right" width="80px" class="padding" nowrap valign="middle">
评定结果:
</td>
<td>
<mc:DataList id="Datalistyyy" runat="server" CellAlign="Center"
CellHeight="" CellValign="Middle" CellWidth="" CellWrap="False"
EmptyHeight="" SelectService="ServiceGetYyyhfxx" DataKeyNames="bh"
DataMember="Hfxx" >
<template>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<label id="lable" runat="server" text=''></label>
</td>
<td>
<mc:radiobutton id="radiobutton1" runat="server" Name="yyy" text=" 非常满意" value="非常满意"/>
<mc:radiobutton id="radiobutton2" runat="server" Name="yyy" text=" 满意" value="满意"/>
<mc:radiobutton id="radiobutton3" runat="server" Name="yyy" text=" 一般" value="一般"/>
<mc:radiobutton id="radiobutton4" runat="server" Name="yyy" text=" 不满意" value="不满意"/>
<mc:radiobutton id="radiobutton5" runat="server" Name="yyy" text=" 很不满意" value="很不满意"/>
</td>
</tr>
</table>
</template>
</mc:DataList>
</td>
</tr>
datalist循环出来几行,每行都有5个单选按钮。
想让没行都是单选,囧,name改成一样之后发现全部只能选一个。
不知道怎样才能让以 行 为单位,单选。
--------------------编程问答-------------------- 加每行一个分组控件 --------------------编程问答-------------------- name="yyy"+行号或主键 --------------------编程问答-------------------- 每一行的name只能变成不一样的,可以生成一个随机的name.. --------------------编程问答-------------------- 把行号和加上一个表示当做name来用 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 怎么加啊? --------------------编程问答-------------------- 生成的name 怎么加行号呢 --------------------编程问答-------------------- <asp:RadioButton ID="RadioButton1" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' />
--------------------编程问答-------------------- 循环的时候加个变量 动态拼接name值就可以 name相同就会变成一组 --------------------编程问答--------------------
我试了一下 ,并没有解决。 --------------------编程问答--------------------
我这没问题
--------------------编程问答-------------------- <asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="178px" Height="52px" RepeatDirection="Horizontal">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:RadioButtonList> --------------------编程问答-------------------- 为什么我的就不好用呢 --------------------编程问答--------------------
<td>
<mc:DataList id="Datalistyyy" runat="server" CellAlign="Center"
CellHeight="" CellValign="Middle" CellWidth="" CellWrap="False"
EmptyHeight="" SelectService="ServiceGetYyyhfxx" DataKeyNames="bh"
DataMember="Hfxx" >
<template>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<label id="lable" runat="server" text="" ></label>
</td>
<td>
<mc:RadioButtonList ID="RadioButtonListYyy" runat="server" >
<mc:ListItem ID="ListItem1" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 非常满意" Value="非常满意">ListItem1</mc:ListItem>
<mc:ListItem ID="ListItem2" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 满意" Value="满意">ListItem2</mc:ListItem>
<mc:ListItem ID="ListItem3" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 一般" Value="一般">ListItem3</mc:ListItem>
<mc:ListItem ID="ListItem4" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 不满意" Value="不满意">ListItem4</mc:ListItem>
<mc:ListItem ID="ListItem5" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 很不满意" Value="很不满意">ListItem5</mc:ListItem>
</mc:RadioButtonList>
</td>
</tr>
</table>
</template>
</mc:DataList>
</td>
我的还是只能选一个 --------------------编程问答--------------------
<td>
<mc:DataList id="Datalistyyy" runat="server" CellAlign="Center"
CellHeight="" CellValign="Middle" CellWidth="" CellWrap="False"
EmptyHeight="" SelectService="ServiceGetYyyhfxx" DataKeyNames="bh"
DataMember="Hfxx" >
<template>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<label id="lable" runat="server" text="" ></label>
</td>
<td>
<mc:RadioButtonList ID="RadioButtonListYyy" runat="server" >
<mc:ListItem ID="ListItem1" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 非常满意" Value="非常满意">ListItem1</mc:ListItem>
<mc:ListItem ID="ListItem2" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 满意" Value="满意">ListItem2</mc:ListItem>
<mc:ListItem ID="ListItem3" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 一般" Value="一般">ListItem3</mc:ListItem>
<mc:ListItem ID="ListItem4" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 不满意" Value="不满意">ListItem4</mc:ListItem>
<mc:ListItem ID="ListItem5" runat="server" GroupName='<%#"yyy"+Container.ItemIndex %>' Text=" 很不满意" Value="很不满意">ListItem5</mc:ListItem>
</mc:RadioButtonList>
</td>
</tr>
</table>
</template>
</mc:DataList>
</td>
我的还是只能选一个 --------------------编程问答--------------------
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="178px" Height="52px" RepeatDirection="Horizontal">--------------------编程问答--------------------
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID="RadioButtonList2" runat="server" Width="178px" Height="52px" RepeatDirection="Horizontal">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:RadioButtonList>
我的那个RadioButtonList 是在td中的,是生成出来的,难道是因为这个不好用?
补充:.NET技术 , C#