CustomValidator.ClientValidationFunction プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CustomValidator.ClientValidationFunction プロパティの意味・解説 

CustomValidator.ClientValidationFunction プロパティ

検証使用するカスタム クライアント側スクリプト関数の名前を取得または設定します

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

<ThemeableAttribute(False)> _
Public Property ClientValidationFunction As
 String
Dim instance As CustomValidator
Dim value As String

value = instance.ClientValidationFunction

instance.ClientValidationFunction = value
[ThemeableAttribute(false)] 
public string ClientValidationFunction { get;
 set; }
[ThemeableAttribute(false)] 
public:
property String^ ClientValidationFunction {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_ClientValidationFunction ()

/** @property */
public void set_ClientValidationFunction (String
 value)
public function get ClientValidationFunction
 () : String

public function set ClientValidationFunction
 (value : String)

プロパティ
検証使用するカスタム クライアント スクリプト関数の名前。既定値は String.Empty で、このプロパティ設定されていないことを示します

メモメモ

関数名にはかっこやパラメータ使用できません。

解説解説
使用例使用例

ClientValidationFunction プロパティ使用してクライアント側検証実行関数の名前を指定する方法コード例次に示します検証関数偶数チェックします

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<html>
<head>

   <script runat="server">

      Sub ValidateBtn_OnClick(sender As Object,
 e As EventArgs) 

         ' Display whether the page passed validation.
         If Page.IsValid Then 

            Message.Text = "Page is valid."

         Else 

            Message.Text = "Page is not valid!"

         End If

      End Sub

      Sub ServerValidation(source As Object,
 args As ServerValidateEventArgs)

         Try 

            ' Test whether the value entered into the text box is even.
            Dim num As Integer
 = Integer.Parse(args.Value)
            args.IsValid = ((num mod 2) = 0)
 
         Catch ex As Exception
         
            args.IsValid = false

         End Try

      End Sub

   </script>      

</head>
<body>

   <form runat="server">
  
      <h3>CustomValidator ServerValidate Example</h3>

      <asp:Label id="Message"  
           Text="Enter an even number:" 
           Font-Name="Verdana" 
           Font-Size="10pt" 
           runat="server"/>

      <p>

      <asp:TextBox id="Text1" 
           runat="server" />
    
      &nbsp;&nbsp;

      <asp:CustomValidator id="CustomValidator1"
           ControlToValidate="Text1"
           ClientValidationFunction="ClientValidate"
           OnServerValidate="ServerValidation"
           Display="Static"
           ErrorMessage="Not an even number!"
           ForeColor="green"
           Font-Name="verdana" 
           Font-Size="10pt"
           runat="server"/>

      <p>
 
      <asp:Button id="Button1"
           Text="Validate" 
           OnClick="ValidateBtn_OnClick" 
           runat="server"/>

   </form>
  
</body>
</html>

<script language="vbscript">

   <!--

   Sub ClientValidate(source, arguments)
            
      If (arguments.Value mod 2) = 0 Then
         arguments.IsValid=true
      Else
         arguments.IsValid=false
      End If

   End Sub

   ' -->

</script>


<%@ Page Language="C#" AutoEventWireup="True" %>

<html>
<head>

   <script runat="server">

      void ValidateBtn_OnClick(object sender, EventArgs e) 
      { 

         // Display whether the page passed validation.
         if (Page.IsValid) 
         {

            Message.Text = "Page is valid.";

         }

         else 
         {

            Message.Text = "Page is not valid!";

         }

      }

      void ServerValidation(object source, ServerValidateEventArgs
 args)
      {

         try 
         {

            // Test whether the value entered into the text box is even.
            int i = int.Parse(args.Value);
            args.IsValid = ((i%2) == 0);

         }

         catch(Exception ex)
         {

            args.IsValid = false;

         }

      }

   </script>    

</head>
<body>

   <form runat="server">
  
      <h3>CustomValidator ServerValidate Example</h3>

      <asp:Label id="Message"  
           Text="Enter an even number:" 
           Font-Name="Verdana" 
           Font-Size="10pt" 
           runat="server"/>

      <p>

      <asp:TextBox id="Text1" 
           runat="server" />
    
      &nbsp;&nbsp;

      <asp:CustomValidator id="CustomValidator1"
           ControlToValidate="Text1"
           ClientValidationFunction="ClientValidate"
           OnServerValidate="ServerValidation"
           Display="Static"
           ErrorMessage="Not an even number!"
           ForeColor="green"
           Font-Name="verdana" 
           Font-Size="10pt"
           runat="server"/>

      <p>
 
      <asp:Button id="Button1"
           Text="Validate" 
           OnClick="ValidateBtn_OnClick" 
           runat="server"/>

   </form>
  
</body>
</html>

<script language="vbscript">

   <!--

   Sub ClientValidate(source, arguments)
            
      If (arguments.Value mod 2) = 0 Then
         arguments.IsValid=true
      Else
         arguments.IsValid=false
      End If

   End Sub

   ' -->

</script>


プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CustomValidator クラス
CustomValidator メンバ
System.Web.UI.WebControls 名前空間
String.Empty


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

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

辞書ショートカット

すべての辞書の索引

「CustomValidator.ClientValidationFunction プロパティ」の関連用語

CustomValidator.ClientValidationFunction プロパティのお隣キーワード
検索ランキング

   

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



CustomValidator.ClientValidationFunction プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS