设置用户控件的属性,以便能够弹出选择项目文件路径

时间:2011-09-13 07:53:46

标签: asp.net user-controls

enter image description here

是否可以设置User Controls的属性以便能够浏览项目中的文件路径,如图所示?

1 个答案:

答案 0 :(得分:1)

是的,请参阅UrlEditor class

基本上,您将声明您的财产:

[EditorAttribute(typeof(System.Web.UI.Design.UrlEditor), typeof(UITypeEditor))]
public string YourProp
{
    get
    {
        return (string)ViewState["YourProp"];          
    }
    set
    {
        ViewState["YourProp"] = value;
    }
}