RadioButton クラスとは? わかりやすく解説

RadioButton クラス

オプション ボタン コントロール表します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class RadioButton
    Inherits CheckBox
    Implements IPostBackDataHandler
public class RadioButton : CheckBox, IPostBackDataHandler
public ref class RadioButton : public
 CheckBox, IPostBackDataHandler
public class RadioButton extends CheckBox implements
 IPostBackDataHandler
public class RadioButton extends
 CheckBox implements IPostBackDataHandler
解説解説

RadioButton サーバー コントロール使用すると、ページ内のほかの内容の間にグループオプション ボタン配置できますすべてのボタンが同じ GroupName プロパティ共有している場合ボタン論理的にグループ化されます

メモメモ

RadioButton コントロール使用すると、ユーザー入力表示できますが、ユーザー入力には悪意のあるクライアント スクリプト含まれている可能性ありますアプリケーション表示する前にクライアントから送信され実行スクリプトSQL ステートメントなどのコード情報はすべて検査してくださいASP.NET には入力要求検証機能があり、ユーザー入力の中のスクリプトHTMLブロックできます検証サーバー コントロールは、ユーザー入力査定する目的でも用意されています。詳細については、「検証サーバー コントロール構文」を参照してください

ユーザー補助

TopicLocation
チュートリアル : Visual Web Developer での ASP.NET マスタ ページ作成使用Visual Studio での ASP .NET Web アプリケーション作成
チュートリアル : カスタム ビジネス オブジェクトへのデータ バインディングVisual Studio での ASP .NET Web アプリケーション作成
チュートリアル: Visual Web Developer でのカスケード スタイル シートスタイル操作Visual Studio での ASP .NET Web アプリケーション作成
方法 : ASP.NET Web サーバー コントロールフォーカス設定するASP .NET Web アプリケーション作成
方法 : RadioButton Web サーバー コントロール グループにおけるユーザー選択応答するASP .NET Web アプリケーション作成
方法 : RadioButton Web サーバー コントロール選択項目を設定および取得するASP .NET Web アプリケーション作成
方法 : RadioButtonList Web サーバー コントロールレイアウト設定するASP .NET Web アプリケーション作成
方法 : Web フォーム ページRadioButton Web サーバー コントロール追加する (Visual Studio)Visual Studio での ASP .NET Web アプリケーション作成
方法 : Web フォーム ページに RadioButtonList Web サーバー コントロール追加するASP .NET Web アプリケーション作成
方法 : Web フォーム ページに RadioButtonList Web サーバー コントロール追加する (Visual Studio)Visual Studio での ASP .NET Web アプリケーション作成
方法 : 各 RadioButton Web サーバー コントロールWeb フォーム ページ追加するASP .NET Web アプリケーション作成
使用例使用例

RadioButton コントロール使用する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<html>
 <head>
 
     <script language="VB" runat="server">

    Sub SubmitBtn_Click(Sender As Object,
 e As EventArgs)
        
        If Radio1.Checked Then
            Label1.Text = "You selected " & Radio1.Text
        ElseIf Radio2.Checked Then
            Label1.Text = "You selected " & Radio2.Text
        ElseIf Radio3.Checked Then
            Label1.Text = "You selected " & Radio3.Text
        End If
    End Sub
 
     </script>
 
 </head>
 <body>
 
     <h3>RadioButton Example</h3>
 
     <form runat=server>
     
         <h4>Select the type of installation you want to
 perform:</h4>
     
         <asp:RadioButton id=Radio1 Text="Typical"
 Checked="True" GroupName="RadioGroup1"
 runat="server" /><br>
         
         This option installs the features most typically used.
  <i>Requires 1.2 MB disk space.</i><p>
             
         <asp:RadioButton id=Radio2 Text="Compact"
 GroupName="RadioGroup1" runat="server"/><br>
         
         This option installs the minimum files required to
 run the product.  <i>Requires 350 KB disk space.</i><p>
          
         <asp:RadioButton id=Radio3 runat="server"
 Text="Full" GroupName="RadioGroup1"
 /><br>
         
         This option installs all features for
 the product.  <i>Requires 4.3 MB disk space.</i><p>
 
         <asp:button text="Submit" OnClick="SubmitBtn_Click"
 runat=server/>
 
         <asp:Label id=Label1 font-bold="true"
 runat="server" />
             
     </form>
 
 </body>
 </html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
 <head>
 
     <script language="C#" runat="server">
 
         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>
 
 </head>
 <body>
 
     <h3>RadioButton Example</h3>
 
     <form runat=server>
     
         <h4>Select the type of installation you want to perform:</h4>
     
         <asp:RadioButton id=Radio1 Text="Typical" Checked="True"
 GroupName="RadioGroup1" runat="server" /><br>
         
         This option installs the features most typically used.  <i>Requires
 1.2 MB disk space.</i><p>
             
         <asp:RadioButton id=Radio2 Text="Compact" GroupName="RadioGroup1"
 runat="server"/><br>
         
         This option installs the minimum files required to run the product.  <i>Requires
 350 KB disk space.</i><p>
          
         <asp:RadioButton id=Radio3 runat="server" Text="Full"
 GroupName="RadioGroup1" /><br>
         
         This option installs all features for the product.  <i>Requires
 4.3 MB disk space.</i><p>
 
         <asp:button text="Submit" OnClick="SubmitBtn_Click"
 runat=server/>
 
         <asp:Label id=Label1 font-bold="true" runat="server"
 />
             
     </form>
 
 </body>
 </html>
 
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.CheckBox
        System.Web.UI.WebControls.RadioButton
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

RadioButton クラス

他の RadioButton コントロール組み合わせることで、ユーザー選択肢グループから 1 つ選択肢を選ぶことができます

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class RadioButton
    Inherits ButtonBase
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class RadioButton : ButtonBase
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
public ref class RadioButton : public
 ButtonBase
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class RadioButton extends ButtonBase
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
public class RadioButton extends
 ButtonBase
解説解説
使用例使用例

RadioButton作成および初期化しトグル ボタンのような外観にするコード例次に示します。AutoCheck プロパティfalse設定してボタンForm追加します

Private Sub InitializeMyRadioButton()
    ' Create and initialize a new RadioButton. 
    Dim radioButton1 As New
 RadioButton()
       
    ' Make the radio button control appear as a toggle button.
    radioButton1.Appearance = Appearance.Button
       
    ' Turn off the update of the display on the click of the control.
    radioButton1.AutoCheck = False
       
    ' Add the radio button to the form.
    Controls.Add(radioButton1)
End Sub

private void InitializeMyRadioButton()
{
   // Create and initialize a new RadioButton. 
   RadioButton radioButton1 = new RadioButton();
   
   // Make the radio button control appear as a toggle button.
   radioButton1.Appearance = Appearance.Button;

   // Turn off the update of the display on the click of the control.
   radioButton1.AutoCheck = false;

   // Add the radio button to the form.
   Controls.Add(radioButton1);
}

private void InitializeMyRadioButton()
{
    // Create and initialize a new RadioButton. 
    RadioButton radioButton1 = new RadioButton();

    // Make the radio button control appear as a toggle button.
    radioButton1.set_Appearance(Appearance.Button);

    // Turn off the update of the display on the click of the control.
    radioButton1.set_AutoCheck(false);
    
    // Add the radio button to the form.
    get_Controls().Add(radioButton1);
} //InitializeMyRadioButton
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ButtonBase
          System.Windows.Forms.RadioButton
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からRadioButton クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からRadioButton クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からRadioButton クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「RadioButton クラス」の関連用語

RadioButton クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RadioButton クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS