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

Dim instance As XhtmlTextWriter Dim attributeName As String Dim returnValue As Boolean returnValue = instance.IsValidFormAttribute(attributeName)
戻り値
属性を form に適用できる場合は true。それ以外の場合は false。

次のコード例は、カスタム Label コントロールと、このコントロールの内容を XHTML にレンダリングするアダプタを作成する大きなコード例の一部です。
このコード例では、attTest という名前の Boolean 変数を作成し、この変数を、IsValidFormAttribute メソッド呼び出しからの戻り値に設定する方法を示します。このメソッドは文字列 "style" をパラメータの引数として渡します。IsValidFormAttribute メソッドが true を返す場合、コントロールと関連付けられるスタイルが HtmlTextWriter.EnterStyle メソッドと HtmlTextWriter.ExitStyle メソッドを使用してレンダリングされます。attTest 値が false の場合、スタイルはレンダリングされません。代わりに、ページは、コントロール用のテキスト、WriteBreak メソッドでレンダリングされる br/ 要素、およびコントロールの XHTML コンテンツが条件付きでレンダリングされていることをユーザーに通知するテキスト文字列を表示します。
このコード例は、XhtmlTextWriter クラスのトピックで取り上げているコード例の一部分です。
' Override the Render method. Protected Overrides Sub Render(ByVal writer As HtmlTextWriter) ' Create an instance of the XhtmlTextWriter class, ' named w, and cast the HtmlTextWriter passed ' in the writer parameter to w. Dim w As XhtmlTextWriter = New XhtmlTextWriter(writer) ' Create a string variable, named value, to hold ' the control's Text property value. Dim value As String = Control.Text ' Create a Boolean variable, named attTest, ' to test whether the Style attribute is ' valid in the page that the control is ' rendered to. Dim attTest As Boolean = w.IsValidFormAttribute("style") ' Check whether attTest is true or false. ' If true, a style is applied to the XHTML ' content. If false, no style is applied. If (attTest = True) Then w.EnterStyle(Control.ControlStyle) End If ' Write the Text property value of the control, ' a <br> element, and a string. w.Write(value) w.WriteBreak() w.Write("This control conditionally rendered its styles for XHTML.") ' Check whether attTest is true or false. ' If true, the XHTML style is closed. ' If false, nothing is rendered. If (attTest = True) Then w.ExitStyle(Control.ControlStyle) End If End Sub 'Render
protected override void Render(HtmlTextWriter writer) { // Create an instance of the XhtmlTextWriter class, // named w, and cast the HtmlTextWriter passed // in the writer parameter to w. XhtmlTextWriter w = new XhtmlTextWriter(writer); // Create a string variable, named value, to hold // the control's Text property value. String value = Control.Text; // Create a Boolean variable, named attTest, // to test whether the Style attribute is // valid in the page that the control is // rendered to. Boolean attTest = w.IsValidFormAttribute("style"); // Check whether attTest is true or false. // If true, a style is applied to the XHTML // content. If false, no style is applied. if (attTest) w.EnterStyle(Control.ControlStyle); // Write the Text property value of the control, // a <br> element, and a string. w.Write(value); w.WriteBreak(); w.Write("This control conditionally rendered its styles for XHTML."); // Check whether attTest is true or false. // If true, the XHTML style is closed. // If false, nothing is rendered. if (attTest) w.ExitStyle(Control.ControlStyle); }

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

- XhtmlTextWriter.IsValidFormAttribute メソッドのページへのリンク