How to display BoundColumn Based on Condition?
http://www.c-sharpcorner.com/Code/2003/June/DisplayBoundColumnBased.asp

解决方案 »

  1.   

    把它放在后台里面吧。
    public string getimage(int lwrestoredegree)
    {
      if(lwrestoredegree == 0)
      {
        return "<img src....";
      }
     ....
    }
    在前面
    <%# getimage(int.Parse(DataBinder.Eval(Container.DataItem,"LWRestoreDegree").ToString()))%>
      

  2.   

    放在datagrid的itemdatabind事件中处理,挺简单的,试试吧
      

  3.   

    模板列里放一个asp:Image控件在DataGrid_ItemCreated事件里((Image)e.Item.FindControl(ImageID)).ImageUrl = ...;