UrlPropertyAttribute 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
UrlPropertyAttribute 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| UrlPropertyAttribute() |
클래스의 새 기본 인스턴스를 초기화합니다 UrlPropertyAttribute . |
| UrlPropertyAttribute(String) |
지정된 문자열로 속성을 설정 Filter 하여 클래스의 UrlPropertyAttribute 새 인스턴스를 초기화합니다. |
UrlPropertyAttribute()
클래스의 새 기본 인스턴스를 초기화합니다 UrlPropertyAttribute .
public:
UrlPropertyAttribute();
public UrlPropertyAttribute();
Public Sub New ()
예제
다음 코드 예제에서는 URL 관련 속성을 구현 하는 클래스를 보여 줍니다. 이 코드 예제에서는 기본 UrlPropertyAttribute 특성이 클래스의 속성에 TargetUrlCustomHyperLinkControl 적용됩니다. 이 특성은 모든 URL 형식에 대한 지원을 나타내며 기본 파일 필터 집합을 "*.*"로 지정합니다.
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.
}
Public Class CustomHyperLinkControl
Inherits WebControl
Public Sub New()
End Sub
' 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
설명
클래스의 UrlPropertyAttribute 기본 인스턴스는 속성이 "*.*" 값으로 Filter 설정된 상태에서 초기화됩니다.
적용 대상
UrlPropertyAttribute(String)
지정된 문자열로 속성을 설정 Filter 하여 클래스의 UrlPropertyAttribute 새 인스턴스를 초기화합니다.
public:
UrlPropertyAttribute(System::String ^ filter);
public UrlPropertyAttribute(string filter);
new System.Web.UI.UrlPropertyAttribute : string -> System.Web.UI.UrlPropertyAttribute
Public Sub New (filter As String)
매개 변수
- filter
- String
URL별 속성과 연결된 파일 필터입니다.
예제
다음 코드 예제에서는 URL 관련 속성을 구현 하는 클래스를 보여 줍니다. 이 코드 예제에서는 UrlPropertyAttribute 클래스의 속성에 특성이 TargetUrlCustomHyperLinkControl 적용됩니다. 이 특성은 ASP.NET 파일에 대한 특정 파일 필터를 설정합니다.
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.
}
Public Class CustomHyperLinkControl
Inherits WebControl
Public Sub New()
End Sub
' 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
설명
이 생성자를 사용하여 UrlPropertyAttribute 만든 클래스의 인스턴스는 속성이 로 설정된 상태에서 Filter 초기화됩니다 filter.