Click here to Skip to main content
15,912,457 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i hava agridex janus control.
if i want to highlight a specific cell depend on another one that contain a date if a date is earlier than today how can i do this i wrote this but all cell's color became red

C#
private void gridEX1_FormattingRow(object sender, RowLoadEventArgs e)
   {

       GridEXFormatStyle red = new GridEXFormatStyle();
       red.BackColor = Color.Red;
        GridEXFormatStyle white = new GridEXFormatStyle();
        white.BackColor = Color.White;

       //int i = 1;
       for (int i = 0; i < gridEX1.RowCount; i++)
       {
           DateTime theResult;

           if (DateTime.TryParse(gridEX1.GetRow(i).Cells[9].Value.ToString(), out theResult))
           {

               int compare = DateTime.Compare(theResult, DateTime.Now);
               if (compare == 0 || compare == -1) gridEX1.RootTable.Columns[12].CellStyle = red;
           }
           else gridEX1.RootTable.Columns[12].CellStyle = white;

       }
   }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900