OK, I have a page with conditional formatting that works when I use this code
But when I use this code (with DataKeyNames defined in the gridview definition)
It shows everything as the first ncrstatus that it encounters in the entire recordset. I would liek to use the second one because I do not want to show the ncrstatus field, I just want to use it for my conditional formatting, but I can only set visible to false if I use the datakeys. I am sure that I am missing something simple. I have tried a few different iterations, my problem keeps coming back to it seems to be not stepping thru the array and I do not know C# well enough yet.
Any help?
Thanks,
Willie
Code:
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Status
string ncrstatus = Convert.ToString(e.Row.Cells[5].Text);
e.Row.Cells[0].BackColor = System.Drawing.Color.FromName(ncrstatus);
}
But when I use this code (with DataKeyNames defined in the gridview definition)
Code:
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Status
string ncrstatus = gvNCR.DataKeys[0].Values["ncrstatus"].ToString();
e.Row.Cells[0].BackColor = System.Drawing.Color.FromName(ncrstatus);
}
It shows everything as the first ncrstatus that it encounters in the entire recordset. I would liek to use the second one because I do not want to show the ncrstatus field, I just want to use it for my conditional formatting, but I can only set visible to false if I use the datakeys. I am sure that I am missing something simple. I have tried a few different iterations, my problem keeps coming back to it seems to be not stepping thru the array and I do not know C# well enough yet.
Any help?
Thanks,
Willie