ASP.NET(vb.net) & RadioButtonList - asp:RadioButtonList - asp:RadioButtonList : Creates a group of radio buttons. This control supports binding to a data source.
ShotDev Focus:
- ASP.NET(vb.net) & RadioButtonList - asp:RadioButtonList
Tag Control :
<asp:RadioButtonList id="RadioButtonList1" AutoPostBack="True|False" CellPadding="Pixels" DataSource="<% databindingexpression %>" DataTextField="DataSourceField" DataValueField="DataSourceField" RepeatColumns="ColumnCount" RepeatDirection="Vertical|Horizontal" RepeatLayout="Flow|Table" TextAlign="Right|Left" OnSelectedIndexChanged="OnSelectedIndexChangedMethod" runat="server"> <asp:ListItem Text="label" Value="value" Selected="True|False" /> </asp:RadioButtonList>
Example
RadioButtonList.aspx
<%@ Page Language="VB" %> <script runat="server"> Sub Button1_Click(sender As Object, e As EventArgs) Me.lblText1.Text = Me.RadioButtonList1.SelectedItem.Text End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form runat="server"> <asp:RadioButtonList id="RadioButtonList1" runat="server"> <asp:ListItem>Item 1</asp:ListItem> <asp:ListItem>Item 2</asp:ListItem> <asp:ListItem>Item 3</asp:ListItem> <asp:ListItem>Item 4</asp:ListItem> <asp:ListItem>Item 5</asp:ListItem> </asp:RadioButtonList> <br /> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button> <hr /> <asp:Label id="lblText1" runat="server"></asp:Label> </form> </body> </html>
Screenshot
1benedict…
…