注册 登录
编程论坛 ASP.NET技术论坛

如何用代码显示RadioButtonList控件选中的项的ListItem??

foshan 发布于 2007-03-15 12:11, 969 次点击
上有四个选项,如何用代码显示所先的选项是第几项(1或2或3或4)?谢谢!

TextBox2.Text = RadioButtonList1.Items.(???).ToString();

如下图,想实现当点击 RadioButtonList控件中的“实情汇报”时,TextBox2显示“2”;当点击 RadioButtonList控件中的“工程报表”时,TextBox2显示“1”;当点击 RadioButtonList控件中的“工地检查通知”时,TextBox2显示“3”????

protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox2.Text = RadioButtonList1.???.ToString();
}
只有本站会员才能查看附件,请 登录

[此贴子已经被作者于2007-3-15 12:18:28编辑过]

3 回复
#2
bygg2007-03-15 12:29
int ItemI = RadioButtonList1.SelectedIndex + 1;
TextBox2.Text = ItemI.ToString();

[此贴子已经被作者于2007-3-15 12:31:00编辑过]

#3
cyyu_ryh2007-03-15 12:29
取它的value值
#4
foshan2007-03-15 12:47
谢谢!
1