UrlPropertyAttribute クラスとは? わかりやすく解説

UrlPropertyAttribute クラス

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

コントロールURL 値を含む文字列プロパティ識別するために使用される属性定義します。このクラス継承できません。

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

<AttributeUsageAttribute(AttributeTargets.Property)> _
Public NotInheritable Class
 UrlPropertyAttribute
    Inherits Attribute
Dim instance As UrlPropertyAttribute
[AttributeUsageAttribute(AttributeTargets.Property)] 
public sealed class UrlPropertyAttribute :
 Attribute
[AttributeUsageAttribute(AttributeTargets::Property)] 
public ref class UrlPropertyAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property) */ 
public final class UrlPropertyAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.Property) 
public final class UrlPropertyAttribute extends
 Attribute
解説解説
使用例使用例

URL 固有のプロパティ実装するクラスコード例次に示します。このコード例では、UrlPropertyAttribute 属性CustomHyperLinkControl クラスTargetUrl プロパティ適用します。この属性は、ASP.NET ファイル固有のファイル フィルタ設定します

Public Class CustomHyperLinkControl
    Inherits WebControl

    Public Sub New()
    End Sub 'New

    ' The TargetUrl property represents the URL that 
    ' the custom hyperlink control navigates to.        
    <UrlProperty("*.aspx")> _
    Public Property TargetUrl() As
 String
        Get
            Dim s As String
 = CStr(ViewState("TargetUrl"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("TargetUrl") = value
        End Set
    End Property

    ' The Text property represents the visible text that 
    ' the custom hyperlink control is displayed with.              
  
    Public Overridable Property
 [Text]() As String
        Get
            Dim s As String
 = CStr(ViewState("Text"))
            If (s Is Nothing)
 Then
                Return String.Empty
            Else
                Return s
            End If
        End Get
        Set(ByVal value As
 String)
            ViewState("Text") = value
        End Set
    End Property

    ' Implement method to render the control.

End Class 'CustomHyperLinkControl
public class CustomHyperLinkControl : WebControl
{
    public CustomHyperLinkControl() { }

    // The TargetUrl property represents the URL that 
    // the custom hyperlink control navigates to.
    [UrlProperty("*.aspx")]
    public string TargetUrl
    {
        get
        {
            string s = (string)ViewState["TargetUrl"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["TargetUrl"] = value;
        }
    }

    // The Text property represents the visible text that 
    // the custom hyperlink control is displayed with.        
    public virtual string Text
    {
        get
        {
            string s = (string)ViewState["Text"];
            return ((s == null) ? String.Empty
 : s);
        }
        set
        {
            ViewState["Text"] = value;
        }
    }

    // Implement method to render the control.
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Attribute
    System.Web.UI.UrlPropertyAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
UrlPropertyAttribute メンバ
System.Web.UI 名前空間



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

辞書ショートカット

すべての辞書の索引

「UrlPropertyAttribute クラス」の関連用語

UrlPropertyAttribute クラスのお隣キーワード
検索ランキング

   

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



UrlPropertyAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS