Radio Buttons in ASP.NET
I'm bit new to .NET. I am using Radio buttons inside a panel in a web page. (Since group boxes are not there). But when I click on each radio button they all are checked. They are not acting as a group but sing开发者_StackOverflow中文版le units.
Do I need to remove the panel here? Please help me.
You're probably missing GroupName
<asp:RadioButton id="button1" runat="server" GroupName="MyGroup" Text="Button 1" />
<asp:RadioButton id="button2" runat="server" GroupName="MyGroup" Text="Button 2" />
<asp:RadioButton id="button3" runat="server" GroupName="MyGroup" Text="Button 3" />
You can use the Radiobuttonlist in ASP.NET toolbar.
And in the SelectedIndexChanged event of the radiobuttonlist you can do what ever you want as you wish. (rblist is the radiobuttonlist)
protected void rbList_SelectedIndexChanged(object sender, EventArgs e)
{
if (rbList.Items[0].Selected)
{
lblHeader.Text = "You selected first option";
}
}
What you want is <asp:RadioButtonList>
.
精彩评论