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

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

ControlBuilder.HasAspCode プロパティ

コントロールコード ブロック格納されているかどうかを示す値を取得します

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

使用例使用例

この例では、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();
            }
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS