UrlPropertyAttribute クラス
アセンブリ: System.Web (system.web.dll 内)
構文<AttributeUsageAttribute(AttributeTargets.Property)> _ Public NotInheritable Class UrlPropertyAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Property)] public sealed class UrlPropertyAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property)] public ref class UrlPropertyAttribute sealed : public Attribute
解説UrlPropertyAttribute 属性は、URL を表すコントロール プロパティに適用される属性です。UrlPropertyAttribute 属性では、文字列プロパティを URL を表すものとしてマークするのに加え、そのプロパティのフィルタ処理に使用する特定のファイルの種類を識別する Filter プロパティを定義します。
使用例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 のセキュリティ
継承階層System.Attribute
System.Web.UI.UrlPropertyAttribute
スレッド セーフ
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照UrlPropertyAttribute コンストラクタ ()
アセンブリ: System.Web (system.web.dll 内)
構文
解説
使用例URL 固有のプロパティを実装するクラスのコード例を次に示します。このコード例では、既定の UrlPropertyAttribute 属性を CustomHyperLinkControl クラスの TargetUrl プロパティに適用します。この属性は、すべての URL をサポートしていることを示し、"*.*" に設定された既定のファイル フィルタを指定しています。
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()> _ 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()] 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 this method to render the control. }
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照UrlPropertyAttribute コンストラクタ (String)
アセンブリ: System.Web (system.web.dll 内)
構文
解説
使用例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. }
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照UrlPropertyAttribute コンストラクタ
オーバーロードの一覧| 名前 | 説明 |
|---|---|
| UrlPropertyAttribute () | UrlPropertyAttribute クラスの新しい既定のインスタンスを初期化します。 |
| UrlPropertyAttribute (String) | UrlPropertyAttribute クラスの新しいインスタンスを初期化し、Filter プロパティを指定した文字列に設定します。 |
参照UrlPropertyAttribute プロパティ
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| Filter | URL 固有のプロパティに関連付けられたファイル フィルタを取得します。 |
| TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
参照UrlPropertyAttribute メソッド
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| Equals | オーバーロードされます。 オーバーライドされます。 指定されたオブジェクトが、UrlPropertyAttribute オブジェクトの現在のインスタンスと等しいかどうかを示します。 |
| GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
| GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
| GetHashCode | オーバーライドされます。 |
| GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
| IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
| IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
| Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
| ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
参照UrlPropertyAttribute メンバ
コントロールで URL 値を含む文字列プロパティを識別するために使用される属性を定義します。このクラスは継承できません。
UrlPropertyAttribute データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| Filter | URL 固有のプロパティに関連付けられたファイル フィルタを取得します。 |
| TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| Equals | オーバーロードされます。 オーバーライドされます。 指定されたオブジェクトが、UrlPropertyAttribute オブジェクトの現在のインスタンスと等しいかどうかを示します。 |
| GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
| GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
| GetHashCode | オーバーライドされます。 |
| GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
| IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
| IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
| Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
| ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
参照- UrlPropertyAttributeのページへのリンク