解决方案 »

  1.   


    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
        if(e.Row.Cells[1].Text==-1){e.Row.Cells[1].Text="<img src='../images/settings.png'/>";}
        //这里可根据你的需求判断呗
       }
    }
      

  2.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
    switch (e.Row.Cells[1].Text)
                {
                    case "0":
                        e.Row.Cells[1].Text = "<img src='../images/0.gif'/>"; break;
    case "1":
                        e.Row.Cells[1].Text = "<img src='../images/1.gif'/>"; break;
    case "-1":
                        e.Row.Cells[1].Text = "<img src='../images/2.gif'/>"; break;
                }
    }
    }
      

  3.   

    谢谢各位回复。可我要的是在AspxGridView控件中,不是GridView控件。RowDataBound事件及e.Rows属性无法使用,请继续指教,谢了先!
      

  4.   

    前台Columns里加一列
    <dx:GridViewDataColumn VisibleIndex="7">
        <HeaderTemplate>
           图片                                    
         </HeaderTemplate>
        <DataItemTemplate>
        <table>
           <tr>
             <td>
                <%# Eval("Images") %>
             </td>
           </tr>
         </table>
         </DataItemTemplate>
    </dx:GridViewDataColumn>
    后台给数据源新增一列Images  给Images列赋值<img src='../images/0.gif'/>;
      

  5.   


    不知道楼主说的是什么控件了!aspx 是.net开发的web页面后缀,GridView数据控件,在前端页面选择GridView,在事件属性页中找到RowDataBound,双击后输入楼上的代码。