62,046
社区成员
发帖
与我相关
我的任务
分享
string value1 = "";
for (int i = 0; i < RadioButtonList1.Items.Count; i++)
{
if (RadioButtonList1.Items[i].Selected)
{
value1 = RadioButtonList1.Items[i].Value;
}
}
string value2 = "";
for (int i = 0; i < RadioButtonList2.Items.Count; i++)
{
if (RadioButtonList2.Items[i].Selected)
{
value2 = RadioButtonList2.Items[i].Value;
}
}
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="非常重要" Value="0.75,1,1"></asp:ListItem>
<asp:ListItem Text="明显重要" Value="0.5,0.75,1"></asp:ListItem>
<asp:ListItem Text="重要" Value="0,0.25,5"></asp:ListItem>
<asp:ListItem Text="稍微重要" Value="0,0,0.25"></asp:ListItem>
<asp:ListItem Text="同等重要" Value="1"></asp:ListItem>
</asp:RadioButtonList>
foreach (Control cl in this.form1.Controls)//遍历表单form1所有控件
{
if (cl is RadioButtonList)
{
RadioButtonList rbl=cl as RadioButtonList;
string selectedValue = rbl.SelectedValue;//获取控件选中值
}
}
string tempStr = "0.75,1,1";//比如这个
string[] select_arr1 = tempStr.Split(',');
string[] select_arr2 = Regex.Split(tempStr,@"(?=,),");