我写了image1.width=300
提示integer不能转换为system.web.ui.webcontrols.unit我应该如何办办?

解决方案 »

  1.   

    image1.width=system.web.ui.webcontrols.unit.pelix(20)//是这么写的,具体的单词名不记得了,有一个按百分比的,有一个是实际长度的,还有其他
      

  2.   

    this.Image1.Width=300;
    可以塞,没报错,你的.net哪个版本?
      

  3.   

    this.Image1.Width=System.Web.UI.WebControls.Unit.Pixel(300);
    :)
      

  4.   

    1)   image1.width=new unit(50,UnitType.Percentage)//占50%的宽度
    2)   在代码中添加样式