HtmlInputCheckBox.Checked プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As HtmlInputCheckBox Dim value As Boolean value = instance.Checked instance.Checked = value
/** @property */ public boolean get_Checked () /** @property */ public void set_Checked (boolean value)
HtmlInputCheckBox コントロールが選択されている場合は true。それ以外の場合は false。

このプロパティを使用して、HtmlInputCheckBox コントロールが選択されているかどうかを確認します。このプロパティは、HtmlInputCheckBox コントロールの状態をプログラムにより設定するときにも使用できます。

HtmlInputCheckBox コントロールのグループからユーザーがコントロールを選択した場合の応答を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <script language="VB" runat=server> Sub SubmitBtn_Click (Source As Object, ByVal E as EventArgs) If (Basketball.Checked = true) Then ' You like basketball End If If (Football.Checked = true) Then ' You like football End If If (Soccer.Checked = true) Then ' You like soccer End If End Sub </script> <body> <form method=post runat=server> Enter Interests: <input id="Basketball" checked type=checkbox runat=server> Basketball <input id="Football" type=checkbox runat=server> Football <input id="Soccer" type=checkbox runat="server"> Soccer <input type=button value="Enter" OnServerClick="SubmitBtn_Click" runat=server> </form> </body> </html>
<%@ Page Language="C#" %> <html > <script language="C#" runat=server> protected void SubmitBtn_Click(object sender, EventArgs e) { if (Basketball.Checked) { // You like basketball } if (Football.Checked) { // You like football } if (Soccer.Checked) { // You like soccer } } </script> <body> <form id="Form1" method=post runat=server> Enter Interests: <input id="Basketball" checked type=checkbox runat=server> Basketball <input id="Football" type=checkbox runat=server> Football <input id="Soccer" type=checkbox runat="server"> Soccer <input id="Button1" type=button value="Enter" OnServerClick="SubmitBtn_Click" runat=server> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <script language="JSCRIPT" runat=server> function SubmitBtn_Click (source : Object, e : EventArgs){ if(Basketball.Checked == true){ // You like basketball } if(Football.Checked == true){ // You like football } if(Soccer.Checked == true){ // You like soccer } } </script> <body> <form method=post runat=server> Enter Interests: <input id="Basketball" checked type=checkbox runat=server> Basketball <input id="Football" type=checkbox runat=server> Football <input id="Soccer" type=checkbox runat="server"> Soccer <input type=button value="Enter" OnServerClick="SubmitBtn_Click" runat=server> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlInputCheckBox.Checked プロパティを検索する場合は、下記のリンクをクリックしてください。

- HtmlInputCheckBox.Checked プロパティのページへのリンク