如何将单选按钮列表项绑定到中继器?我有一个中继器控件。我需要获取单选按钮列表中已经存在的项目。
问问题
750 次
2 回答
0
您应该在中继器中使用带有单选按钮的表,而不是具有相同组的 RadioButtonList
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<table>
<tr>
<td>
<asp:RadioButton ID="OptionsRadioButton" runat="server" Width="332px" Text='<%E# val("Title") %>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
于 2014-04-17T10:55:01.270 回答
0
您将不得不循环并在 Repeater 中找到每个 RadioButtonList 并插入数据
foreach (RepeaterItem item in rptComments.Items)
{
string value = (item.FindControl("rptComments") as RadioButtonList).SelectedValue;
//Code to insert data here
}
于 2014-04-17T11:59:57.267 回答