前不久给自己的分页控件的跳转按钮换成图片按钮, 添加了一个图像路径的属性,一边使用者可以自定按钮义图片 ,发现在使用的时候,不能象设置.net的内置控件如 HyperLink的ImageUrl属性那样,弹出选择图片文件的对话框,上csdn问了一下,然后查找了一下sdk,解决了这个问题

在属性定义前加上标签


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

就ok了。。。 我的代码如下:

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

public virtual string GotoImageUrl
  {
   get
   {
    string text1 = (string) this.ViewState["GotoImageUrl"];
    if (text1 != null)
    {
     return text1;
    }
    return string.Empty;
   }
   set
   {
    this.ViewState["GotoImageUrl"] = value;
   }
  }

如此类推,实现其他类型的文件路径选择,也是一般,不过如果实现若干个枚举呢?

嗯,有空研究一下。

相关文章:

  • 2021-08-12
  • 2021-11-21
  • 2022-12-23
  • 2021-10-20
  • 2022-02-13
  • 2022-03-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
相关资源
相似解决方案