i have a dropdownlist with two values status- 'pending' and 'completed'. while im entering a new task my status is 'pending' once i finish it off i ll change my status as 'completed'. i have displayed it in gridview. the cell which i update as 'completed' have to be highlighted and the remaining cells in the status column i.e 'pending' has to be in another color
+1
A:
If a serverside callback is possible in this scenario, then subscribe the OnRowDataBound-Event and look for the specific row and set the css class of a label to something different. You could use a TemplateColumn with a Label in it.
E.g.
protected void grid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == RowType.DataRow)
{
YourObject _item = (YourObject)e.Row.DataItem;
Literal _litFromTemplate = (Literal)e.Row.FindControl("litFromTemplate");
if(_item.Equals(anotherItem)) // or check for any other condition, like _item.Foo == 123
{
_litFromTemplate.CssClass = 'highlightingMe';
}
else
{
_litFromTemplate.CssClass = 'normalcssclass';
}
}
}
citronas
2010-01-02 10:18:44