<asp:RadioButton AccessKey="string" AutoPostBack="True|False" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CausesValidation="True|False" Checked="True|False" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" GroupName="string" Height="size" ID="string" OnCheckedChanged="CheckedChanged event handler" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" Text="string" TextAlign="Left|Right" ToolTip="string" ValidationGroup="string" Visible="True|False" Width="size" > </asp:RadioButton>
<%@ Page Language="C#" Debug="true" %> <script runat="server"> void Button1_Click(object sender, EventArgs e) { if(this.RadioButton1.Checked == true) { this.lblText1.Text = "Option 1 Checked"; } if(this.RadioButton2.Checked == true) { this.lblText1.Text = "Option 2 Checked"; } } void RadioButton3_CheckedChanged(object sender, EventArgs e) { if(this.RadioButton3.Checked == true) { this.lblText1.Text = "Option 3 Checked"; } } </script> <html> <head> </head> <body> <form runat="server"> <asp:RadioButton id="RadioButton1" runat="server" text="Option 1" GroupName="Group1"></asp:RadioButton> <asp:RadioButton id="RadioButton2" runat="server" text="Option 2" GroupName="Group1"></asp:RadioButton> <br> <asp:RadioButton id="RadioButton3" runat="server" text="Option 3" GroupName="Group2" AutoPostBack="true" OnCheckedChanged="RadioButton3_CheckedChanged"></asp:RadioButton> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button> <hr /> <asp:Label id="lblText1" runat="server"></asp:Label> <br> <asp:Label id="lblText2" runat="server"></asp:Label> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท