this.resultColumns.Add(new BoundField() { HeaderText = "温度", DataField = "TemperValue", SortExpression = "TemperValue" });
代码如上所示。我怎么取出dataField中的值。并且根据不同的值修改颜色呢?各位大虾帮帮忙!!!急急!!!!

解决方案 »

  1.   


    问题还是没看懂你点击的哪个控件,就大哪个控件里写事件取值根据取出来的值,写个switchcase去判断并修改颜色
      

  2.   

    获取那一列设置Style
    如果是控件,用FindControl找到控件,在设置Style
      

  3.   

    问题已经解决了。这是自己写的代码
    for (int i = 0; i < gridView.Rows.Count; i++)
                {
                    int a;
                    int b;
                    a = Convert.ToInt32((gridView.Rows[i].Cells[7].Controls[0] as HyperLink).Text.ToString().Trim());
                    b = Convert.ToInt32((gridView.Rows[i].Cells[8].Controls[0] as HyperLink).Text.ToString().Trim());
                    if ((a > 30 && a < 100) || (b > 30 && b < 100))
                    {
                        this.gridView.Rows[i].Cells[0].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[1].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[2].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[3].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[4].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[5].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[6].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[7].BackColor = System.Drawing.Color.Yellow;
                        this.gridView.Rows[i].Cells[8].BackColor = System.Drawing.Color.Yellow;
                    }