Click here to Skip to main content
14,835,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

My Page has a Gridview and a Servertimer control.

Gridview cells color should change if server time elapses.

Say for example, My ServerTime is 7.35 AM
If my Cell value is "7.31.00" means it elapsed when compared to ServerTime, so I need its color to change "Red".
else I would be in same Khaki color.

Any help would be much useful.

Thanks,
Vidhya.
Posted

Hi Vidhya,

Please use following:
C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string time= e.Row.Cells[0].Text;
            string[] names = new string[] { "170", "171" };
            if (time >= DateTime.Now.Tostring("HH:mm:ss"))
            {
                e.Row.Cell[0].BackColor = "LightBlue";
            }
        }
    }


Thanks,
Imdadhusen
   
Hi Imdadhusen,

Thanks for your reply.

Is there anyway we can do it in Javascript?

Regards,
Vidhya.
   
Comments
pankajupadhyay29 7-Mar-11 5:30am
   
don't write this in solution use Add comment Link in Imdadhusen's solution only then Imdadhusen will notify.
project_id 26-Sep-11 5:38am
   
plz provide me the solution 4 it in javascript....please mail me soln at vivekgoel5@gmail.com

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