Hi,
I have a requirement where I have to compare dates which are in the binded data set to grid. The priority column has to be set to a value and format the cell color to red/orange/gree based on the value of Targetdt and warningdate which is available in the datasource binded to the grid.
I am doing the following.
the above WarningDate and TargetDt columns are not added as the columns in the grid, hence they are coming as null and giving a exception.
I checked the rowinfo databounditem and it is also null. Please advice.
regards,
Khizar
I have a requirement where I have to compare dates which are in the binded data set to grid. The priority column has to be set to a value and format the cell color to red/orange/gree based on the value of Targetdt and warningdate which is available in the datasource binded to the grid.
I am doing the following.
void rGridViewTasks_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement.ColumnInfo.Name == "Priority")
{
//if ((DateTime)e.CellElement.RowInfo.Cells["TargetDt"].Value >= DateTime.Now )
//{
// e.CellElement.BackColor = Color.DarkRed;
// e.CellElement.Value = "1";
//}
//else if (((DateTime)e.CellElement.RowInfo.Cells["WarningDate"].Value >= DateTime.Now) &&
// ((DateTime)e.CellElement.RowInfo.Cells["TargetDt"].Value < DateTime.Now))
//{
// e.CellElement.BackColor = Color.DarkOrange;
// e.CellElement.Value = "2";
//}
//else
//{
// e.CellElement.BackColor = Color.DarkGreen;
// e.CellElement.Value = "3";
//}
}
}
the above WarningDate and TargetDt columns are not added as the columns in the grid, hence they are coming as null and giving a exception.
I checked the rowinfo databounditem and it is also null. Please advice.
regards,
Khizar