[Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]无效的可能原因

时间:2023-02-14 08:49:51

开发的用户控件封存在dll中,其他都很顺利,就是这个图片弹出选择路径怎么也搞不出来!(浪费了我半天*2,o(︶︿︶)o 唉,犟脾气拗不过

看了很多搜索信息都说加:

[Editor(typeof(ImageUrlEditor), typeof(UITypeEditor))]

[EditorAttribute(typeof(System.Web.UI.Design.ImageUrlEditor), typeof(UITypeEditor))]

[EditorAttribute("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]

但是,都没用,简直快到穷途末路了。。。然后下到一个Foreigner在ASP论坛提问相关问题时上传的一个控件项目

http://forums.asp.net/p/1134139/1810467.aspx

把里面的属性完全拷贝出来,一个一个试,终于发现是下面这货没加:

[UrlProperty("*.jpeg;*.jpg;*.gif;*.png;")]

把这条加上,然后重新引用重新添加控件,终于OK了。

PS.也下了其他两个网上的项目源代码资源,但是都没有这句,不知道别人是怎么pass的,真是太邪门了>_<