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

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

ControlBuilder.HasBody メソッド

コントロール開始タグ終了タグ両方タグ含めかどうか決定します。このメソッドASP.NET ページ フレームワークによって呼び出されます。

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

解説解説

このメソッドは、解析中に ASP.NET ページ フレームワークによって呼び出されるもので、コードから直接使用するためのものではありません。

使用例使用例

この例では、ControlType プロパティチェックして、このビルダ適用されるコントロールの型を判断するように OnAppendToParentBuilder メソッドオーバーライドされています。このコントロールが CustomTextBox である場合ビルダは HasAspCode プロパティの値をチェックし、そのコントロールコード ブロック含まれているかどうか確認しますコード ブロック含まれている場合例外スローされ、含まれていない場合HasBody メソッド呼び出されます。

Imports System
Imports System.Web.UI
Imports System.Web
Imports System.Security.Permissions

Namespace ASPNET.Samples

   <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
   Public NotInheritable Class
 AppendControlBuilder
      Inherits ControlBuilder

      ' Override the OnAppendToParentBuilder method.
      Overrides Public Sub
 OnAppendToParentBuilder( _
         ByVal parentBuilder As ControlBuilder
 _
      )
            ' Check whether the type of the control this builder
            ' is applied to is CustomTextBox. If so, check whether
            ' ASP code blocks exist in the control. If so, call
            ' throw an Exception, if not, call the HasBody method. 
       
            If ControlType Is Type.GetType("CustomTextBox")
 Then
                If HasAspCode = True Then
                    Throw New Exception("This
 control cannot contain code blocks.")
                Else
                    HasBody()
                End If
            End If

        End Sub

   End Class

End Namespace
using System;
using System.Web.UI;
using System.Web;
using System.Security.Permissions;

namespace ASPNET.Samples
{
    [
    AspNetHostingPermission(SecurityAction.Demand,
        Level=AspNetHostingPermissionLevel.Minimal)
    ]
    public class AppendControlBuilder : ControlBuilder
    {
        // Override the OnAppendToParentBuilder method.
        public override void OnAppendToParentBuilder(ControlBuilder
 parentBuilder)
        {
            // Check whether the type of the control this builder
            // is applied to is CustomTextBox. If so, check whether
            // ASP code blocks exist in the control. If so, call
            // throw an Exception, if not, call the HasBody method.
        
            if (ControlType == Type.GetType("CustomTextBox"))
            {
                if (HasAspCode)
                    throw new Exception("This control cannot
 contain code blocks.");
                else
                    HasBody();
            }
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlBuilder クラス
ControlBuilder メンバ
System.Web.UI 名前空間



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

辞書ショートカット

すべての辞書の索引

「ControlBuilder.HasBody メソッド」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS