RDiehl Posted February 25, 2008 Report Share Posted February 25, 2008 I'm looking for something at page load/data bound that sets text or background color in a target column based on the value in another column. In one post I saw a suggestion on iterating items 'on data bound' to apply format but I need something more specfic. Quote Link to comment Share on other sites More sharing options...
AngelR Posted February 25, 2008 Report Share Posted February 25, 2008 Try a different event, like Grid Rendering: protected void Grid1_Rendering(object sender, EventArgs e) { try { Color RedColor = Color.Red; Color BlueColor = Color.Blue; foreach (GridItem Item in Grid1.Items) { if (Convert.ToDouble(Item.Cells[0].Text) < 5) { Item.Style.BackColor = RedColor; } else { Item.Style.BackColor = BlueColor; } } } finally { } } Let me know if this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.