XhtmlTextWriter.IsValidFormAttribute メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > XhtmlTextWriter.IsValidFormAttribute メソッドの意味・解説 

XhtmlTextWriter.IsValidFormAttribute メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

XHTML 属性チェックしてform 要素開始タグにその XHTML 属性レンダリングできるかどうか確認します要求デバイスXHTML ドキュメント タイプサポートしているかどうかによって条件付き属性レンダリングする場合IsValidFormAttribute メソッド呼び出します。

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

Public Overrides Function
 IsValidFormAttribute ( _
    attributeName As String _
) As Boolean
Dim instance As XhtmlTextWriter
Dim attributeName As String
Dim returnValue As Boolean

returnValue = instance.IsValidFormAttribute(attributeName)
public override bool IsValidFormAttribute (
    string attributeName
)
public:
virtual bool IsValidFormAttribute (
    String^ attributeName
) override
public boolean IsValidFormAttribute (
    String attributeName
)
public override function IsValidFormAttribute
 (
    attributeName : String
) : boolean

パラメータ

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);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XhtmlTextWriter クラス
XhtmlTextWriter メンバ
System.Web.UI 名前空間


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

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

辞書ショートカット

すべての辞書の索引

XhtmlTextWriter.IsValidFormAttribute メソッドのお隣キーワード
検索ランキング

   

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



XhtmlTextWriter.IsValidFormAttribute メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS