CompareValidator.ControlPropertiesValid メソッド

Dim returnValue As Boolean returnValue = Me.ControlPropertiesValid


CompareValidator.ControlPropertiesValid メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim returnValue As Boolean returnValue = Me.ControlPropertiesValid
コントロールのプロパティが有効な場合は true。それ以外の場合は false。

次のコード例では、カスタム サーバー コントロールの ControlPropertiesValid メソッドをオーバーライドして、CompareValidator コントロールの ControlToCompare プロパティがページに存在し、検証プロパティを含む限り、常に表示プロパティの値を返す方法を示します。
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %> <%@ Page language="VB" %> <HTML> <HEAD> <title>Custom CompareValidator - ControlPropertiesValid - VB.NET Example</title> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom CompareValidator - ControlPropertiesValid - C# Example</h3> <asp:TextBox id="TextBox1" runat="server">123</asp:TextBox><BR> <aspSample:CustomCompareValidatorControlPropertiesValid id="CompareValidator1" runat="server" Display="Dynamic" ErrorMessage="The value of TextBox1 must be '456'." ControlToValidate="TextBox1" ValueToCompare="456" /><br> <asp:Button id="Button1" runat="server" Text="Button" /> </form> </body> </HTML> <br /><span space="preserve">...</span><br />Imports System.Web Imports System.Security.Permissions Namespace Samples.AspNet.VB.Controls <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _ Public NotInheritable Class CustomCompareValidatorControlPropertiesValid Inherits System.Web.UI.WebControls.CompareValidator Protected Overrides Function ControlPropertiesValid() As Boolean ' Determine whether the ControlToValidate is on the page and contains a validation properties. MyBase.CheckControlValidationProperty(Me.ControlToValidate, "ControlToValidate") ' If the control is visible, then control is valid and ready for validation. Dim control As System.Web.UI.Control = Me.FindControl(Me.ControlToValidate) If control.Visible = True Then Return True Else Return False End If End Function End Class End Namespace
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %> <%@ Page language="c#" %> <HTML> <HEAD> <title>Custom CompareValidator - ControlPropertiesValid - C# Example</title> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Run the Page Validate method in order to force // the CompareValidate to show it's error message. Page.Validate(); } </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom CompareValidator - ControlPropertiesValid - C# Example</h3> <asp:TextBox id="TextBox1" runat="server">123</asp:TextBox><BR> <aspSample:CustomCompareValidatorControlPropertiesValid id="CompareValidator1" runat="server" Display="Dynamic" ErrorMessage="The value of TextBox1 must be '456'." ControlToValidate="TextBox1" ValueToCompare="456" /><br> <asp:Button id="Button1" runat="server" Text="Button" /> </form> </body> </HTML> <br /><span space="preserve">...</span><br />using System.Web; using System.Security.Permissions; namespace Samples.AspNet.CS.Controls { [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)] public sealed class CustomCompareValidatorControlPropertiesValid : System.Web.UI.WebControls.CompareValidator { protected override bool ControlPropertiesValid() { // Determine whether the ControlToValidate is on the page and contains a validation properties. base.CheckControlValidationProperty(this.ControlToValidate, "ControlToValidate"); // If the control is visible, then control is valid and is ready for validation. System.Web.UI.Control control = this.FindControl(this.ControlToValidate); return control.Visible; } } }
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %> <%@ Page language="VJ#" %> <HTML> <HEAD> <title>Custom CompareValidator - ControlPropertiesValid - VJ# Example</title> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Run the Page Validate method in order to force // the CompareValidate to show it's error message. get_Page().Validate(); } //Page_Load </script> </HEAD> <body> <form id="Form1" method="post" runat="server"> <h3>Custom CompareValidator - ControlPropertiesValid - VJ# Example</h3> <asp:TextBox id="TextBox1" runat="server" Text="123"></asp:TextBox><BR> <aspSample:CustomCompareValidatorControlPropertiesValid id="CompareValidator1" runat="server" Display="Dynamic" ErrorMessage="The value of TextBox1 must be '456'." ControlToValidate="TextBox1" ValueToCompare="456" /><br> <asp:Button id="Button1" runat="server" Text="Button" /> </form> </body> </HTML> <br /><span space="preserve">...</span><br />package Samples.AspNet.JSL.Controls; public class CustomCompareValidatorControlPropertiesValid extends System.Web.UI.WebControls.CompareValidator { protected boolean ControlPropertiesValid() { // Determine whether the ControlToValidate is on the page // and contains a validation properties. super.CheckControlValidationProperty(this.get_ControlToValidate() , "ControlToValidate"); // If the control is visible, then control is valid and is ready // for validation. System.Web.UI.Control control = this.FindControl(this.get_ControlToValidate()); return control.get_Visible(); } //ControlPropertiesValid } //CustomCompareValidatorControlPropertiesValid

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に収録されているすべての辞書からCompareValidator.ControlPropertiesValidを検索する場合は、下記のリンクをクリックしてください。

- CompareValidator.ControlPropertiesValidのページへのリンク