关于radiobutton控件与radiobuttonlist控件
请问一下,radiobutton与radiobuttonlist控件有什么不同吗,几个radiobutton构成一个组不就构成了一个radiobuttonlist了吗?还有检测radiobutton和radiobuttonlist的选中的值分别应该怎样来检测?谢了
for radiobutton:
void SubmitBtn_Click(Object Sender, EventArgs e)
{
if (Radio1.Checked)
{
Label1.Text = "You selected " + Radio1.Text;
}
else if (Radio2.Checked)
{
Label1.Text = "You selected " + Radio2.Text;
}
else if (Radio3.Checked)
{
Label1.Text = "You selected " + Radio3.Text;
}
}
</script>
for radiobuttonlist:
script runat="server">
void Button1_Click(object Source, EventArgs e)
{
if (RadioButtonList1.SelectedIndex > -1)
{
Label1.Text = "You selected: " +
RadioButtonList1.SelectedItem.Text;
}
}
void chkLayout_CheckedChanged(Object sender, EventArgs e)
{
if (chkLayout.Checked == true)
{
RadioButtonList1.RepeatLayout = RepeatLayout.Table;
}
else
{
RadioButtonList1.RepeatLayout = RepeatLayout.Flow;
}
}
void chkDirection_CheckedChanged(Object sender, EventArgs e)
{
if (chkDirection.Checked == true)
{
RadioButtonList1.RepeatDirection = RepeatDirection.Horizontal;
}
else
{
RadioButtonList1.RepeatDirection = RepeatDirection.Vertical;
}
}
</script>
radiobutton 可以复选。radiobuttonlist里的radio不可复选