本帖最后由 jason110163 于 2009-12-27 18:01:20 编辑

解决方案 »

  1.   

     前台
    <%# setString(eval("列名").Tostring())%>
    后台
    public void  setString(str)
    {
     string strReturn="";
    if(str=1||tr=2||tr=3||tr=4||tr=5||tr=7)
    {
      strRretu=<font color=red>" + str + "</font>"
    }
    if(str=0||tr=3||tr=6||tr=8||tr=9)
    {
      strRretu=<font color=blue>" + str + "</font>"
    }
    return strRretu;
    }
      

  2.   

    请修改好后 发送到我邮箱 [email protected] 晕
      

  3.   


    不好意思呀,自己试着改了下没成功
    能不能改好发到我邮箱
    源文件下载地址:  http://www.rayfile.com/files/4e865a38-f2c0-11de-8bd6-0014221b798a/ 
      

  4.   

    在OnRowDataBound事件里面,取得number的值,再取得column1的控件,再显示
    试试吧,很好玩的~~
    if((Label)e.Item.Cell[2].Text=="1") //Cell2指第三列,单元格里没控件的话用Cells
      (Label)e.Item.FindControl("LabelID").BackColor = "Red"; //单元格里有控件用FindControl()
    else
      (Label)e.Item.FindControl("LabelID").BackColor = "Red";
      

  5.   

    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    int x = (int)dataGridView1.Rows[i].Cells["number"].Value;
                    //1、2、4、5、7
                    if (x == 1 || x == 2 || x == 4 || x == 5 || x == 7)
                    {
                        dataGridView1.Rows[i].Cells["Columns1"].Style.BackColor = Color.Red;
                    }
                    else
                    {
                        dataGridView1.Rows[i].Cells["Columns1"].Style.BackColor = Color.Blue;
                    }
                }
      

  6.   

    会提示
    未处理 System.NullReferenceException
    要怎么解决?
      

  7.   

    问题解决了 ,原来是循环时候 最后碰到空值也强行转换int导致的错误