Hi! I want to change color of text in each grid row, based on a datakey value. It works fine in all columns but for the text in gridHyperLinkColumn. What to do? I have a custom skin defined on the grid, and this is what I do in code behind. Please can you help me?
Thanks,
Ana
| void GridMyTasks_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| try |
| { |
| if ((e.Item.ItemType == GridItemType.Item) || (e.Item.ItemType == GridItemType.AlternatingItem)) |
| { |
| if (e.Item.DataItem != null) |
| { |
| string dueDate = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ActivityDueDate"].ToString().Trim(); |
| if (dueDate != "") |
| { |
| DateTime date = Convert.ToDateTime(dueDate); |
| if (date<DateTime.Today) |
| { |
| e.Item.ForeColor = System.Drawing.Color.Red; |
| } |
| else if (date < DateTime.Today.AddDays(10)) |
| { |
| e.Item.ForeColor = System.Drawing.Color.Orange; |
| } |
| } |
| } |
| } |
| } |
| catch (Exception ex) |
| { |
| ShowLabel(ex); |
| } |
| } |
Ana
