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

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

MobilePage.AllowCustomAttributes プロパティ

ページ上のコントロールカスタム属性定義できるかどうかを示す値を取得します既定値は、web.config の <mobilecontrols> セクションにある allowCustomAttributes 属性の値です。

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

<BindableAttribute(False)> _
Public Property AllowCustomAttributes As
 Boolean
Dim instance As MobilePage
Dim value As Boolean

value = instance.AllowCustomAttributes

instance.AllowCustomAttributes = value
[BindableAttribute(false)] 
public bool AllowCustomAttributes { get;
 set; }
[BindableAttribute(false)] 
public:
property bool AllowCustomAttributes {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_AllowCustomAttributes ()

/** @property */
public void set_AllowCustomAttributes (boolean
 value)
public function get AllowCustomAttributes
 () : boolean

public function set AllowCustomAttributes
 (value : boolean)

プロパティ
ページ上のコントロールカスタム属性定義できる場合trueそれ以外場合false

解説解説

ASP.NET ページ フレームワークには、IAttributeAccessor インターフェイスの他に、CustomAttributes ディクショナリが用意されています。このディクショナリを使用すると、追加属性指定カスタム属性の有効と無効切り替えコントロール動作またはレンダリング調整を行うことができますカスタム属性の有効と無効切り替えるには、AllowCustomAttributes プロパティtrue設定するか、Web.config の <mobileControls> セクションにある allowCustomAttributes 属性true設定します

メモメモ

カスタム属性有効にすると、プロパティ名の入力ミスカスタム属性解釈されることがあります。たとえば、開発者コントロールText プロパティ誤って "Txet" と入力しても、例外発生せず、"Txet" という名前のカスタム属性として保存されしまいます。この理由から、カスタム属性既定無効になっています。

使用例使用例

AllowCustomAttributes プロパティ使用してCommandカスタム AccessKey 属性有効にする方法の例を次に示します

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要があります詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage"
 %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls"
 
    Assembly="System.Web.Mobile"
 %>
<%@ Import Namespace="System.Web.Mobile"
 %>

<script runat="server">
    Private Sub Command_OnClick(ByVal
 sender As Object, ByVal
 e As EventArgs)
        ' Display the other form
        If ActiveForm.ID = "Form1"
 Then
            ActiveForm = Form2
        Else
            ActiveForm = Form1
        End If
    End Sub

    Public Function isAccessKey(ByVal
 caps As MobileCapabilities, _
        ByVal optValue As String)
 As Boolean
        
        ' Determine if the browser is not a Web crawler 
        ' and can use access keys
        If Not caps.Crawler AndAlso
 caps.SupportsAccesskeyAttribute Then
            Return True
        End If
        Return False
    End Function

</script>

<html  >
<body>
    <mobile:Form runat="server" id="Form1"
 >
        <mobile:Label ID="Label1" Runat="server">This
 is Form1</mobile:Label>
        <mobile:Command id="cmd1" runat="server"
 Text="No AccessKey" 
            onClick="Command_OnClick">
            <DeviceSpecific>
               <Choice Filter="isAccessKey" Text="AccessKey
 is 1"/>
            </DeviceSpecific>
        </mobile:Command>
        <mobile:Label id="Label2" runat="server"
 />
    </mobile:Form>
    <mobile:Form ID="Form2" Runat="server">
        <mobile:Label ID="Label3" Runat="server">This
 is Form2</mobile:Label>
        <mobile:Command id="cmd2" runat="server"
 text="Back to Form1"
            onClick="Command_OnClick">
            <DeviceSpecific>
                <Choice Filter="isAccessKey" Text="1
 is AccessKey" AccessKey="1" />
            </DeviceSpecific>
        </mobile:Command>
    </mobile:Form>
</body>
</html>
<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Mobile" %>

<script runat="server">
    private void Command_OnClick(object sender,
 EventArgs e)
    {
        // Display the other form
        if (ActiveForm.ID == "Form1")
            ActiveForm = Form2;
        else
            ActiveForm = Form1;
    }

    public bool isAccessKey(MobileCapabilities
 caps, 
        string optValue)
    {
        // Determine if the browser is not a Web crawler 
        // and can use access keys
        if (!caps.Crawler && caps.SupportsAccesskeyAttribute)
            return true;
        return false;
    }
</script>

<html  >
<body>
    <mobile:Form runat="server" id="Form1" >
        <mobile:Label Runat="server">This is Form1</mobile:Label>
        <mobile:Command id="cmd1" runat="server" Text="No
 AccessKey" 
            onClick="Command_OnClick">
            <DeviceSpecific>
               <Choice Filter="isAccessKey" Text="AccessKey is
 1"/>
            </DeviceSpecific>
        </mobile:Command>
        <mobile:Label id="Label1" runat="server" />
    </mobile:Form>
    <mobile:Form ID="Form2" Runat="server">
        <mobile:Label Runat="server">This is Form2</mobile:Label>
        <mobile:Command id="cmd2" runat="server" text="Back
 to Form1"
            onClick="Command_OnClick">
            <DeviceSpecific>
                <Choice Filter="isAccessKey" Text="1 is AccessKey"
 AccessKey="1" />
            </DeviceSpecific>
        </mobile:Command>
    </mobile:Form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS