求助?
如何用c#获取RadioButtonList控件中选中的Items值
RadioButtonList1.SelectedItem
RadioButtonList1.SelectedItem.Text
RadioButtonList1.SelectedItem.Value
RadioButtonList1.SelectedIndex
RadioButtonList 控件为网页开发人员提供了一组单选按钮,这些按钮可以通过数据绑定动态生成。该控件包含一个 Items 集合,集合中的成员与列表中的各项相对应。若要确定选择了哪一项,请测试列表的 SelectedItem 属性。
RadioButtonList.SelectedItem.text
RadioButtonList1.Items[3].Selected=true;设定选中项
最简单的:
Request.form["RadioButtonListName"]
public void Button1_Click (object sender, System.EventArgs e)
{
if (RadioButtonList1.SelectedIndex > -1)
{
Label1.Text="You chose: " + RadioButtonList1.SelectedItem.Text;
}
}
例如:
string str = this.RadioButtonList1.SelectedItem.Value;
SelectedValue
RadioButtonList1.SelectedItem.Text
RadioButtonList1.SelectedItem.Value
RadioButtonList1.SelectedIndex
RBListSex.Items[RBListSex.SelectedIndex].Value.Trim();
RBtnListBuyPan.SelectedItem.Value.Trim();