在datagrid的ondatabound事件中可以判断,比如,第一列用ID=LB1的LABEL来绑定,第二列用ID=LB2的LABEL的绑定
if cint(ctype(e.item.foundcontrol("lb1"),label).text))>cint(ctype(e.item.foundcontrol("lb1"),label).text)) then
   e.item.cells(0).backcolor=system.drawing.color.red
end if

解决方案 »

  1.   

    private void MyDataGrid_OnItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){
      if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem){
    if(Int32.Parse(e.Item.Cells[3].Text)>Int32.Parse(e.Item.Cells[4].Text)){
    e.Item.Cells[5].BackColor = Color.Red;
     }
    }
      

  2.   

    试一下先!
    高手帮我回答一下水晶报表问题?是不是我的.net visual studio 有必要重装了?
      

  3.   

    仍旧在这一行显示错
    if(Int32.Parse(e.Item.Cells[6].Text)>Int32.Parse(e.Item.Cells[5].Text))“Input string was not in a correct format”???