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

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

ControlValuePropertyAttribute.DefaultValue プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

コントロール既定プロパティ既定値取得します

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

解説解説
使用例使用例

ControlValuePropertyAttribute 属性カスタム コントロール適用することで、DefaultValue プロパティ設定する方法次のコード例示します

Imports System.ComponentModel
Imports System.Web.UI

Namespace Samples.AspNet.VB.Controls

    ' Set ControlValueProperty attribute to specify the default
    ' property of this control that a ControlParameter object 
    ' binds to at run time.
    <DefaultProperty("Text"), ControlValueProperty("Text",
 "DefaultText")> Public Class
 SimpleCustomControl
        Inherits System.Web.UI.WebControls.WebControl

        Dim _text As String

        <Bindable(True), Category("Appearance"),
 DefaultValue("")> Property
 [Text]() As String
            Get
                Return _text
            End Get

            Set(ByVal Value As
 String)
                _text = Value
            End Set
        End Property

        Protected Overrides Sub
 Render(ByVal output As System.Web.UI.HtmlTextWriter)
            output.Write([Text])
        End Sub

    End Class

End Namespace

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
{
    // Set ControlValueProperty attribute to specify the default
    // property of this control that a ControlParameter object 
    // binds to at run time.
    [DefaultProperty("Text")]
    [ControlValueProperty("Text", "Default Text")]
    public class SimpleCustomControl : WebControl
    {
        private string text;

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        public string Text
        {
            get
            {
                return text;
            }
            set
            {
                text = value;
            }
        }

        protected override void Render(HtmlTextWriter
 output)
        {
            output.Write(Text);
        }
    }
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlValuePropertyAttribute クラス
ControlValuePropertyAttribute メンバ
System.Web.UI 名前空間
ControlParameter
Name



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS