Benjamin Allen

Benjamin Allen

  • NA
  • 34
  • 7.8k

Using label display timenow to mark checkbox(s)

Apr 27 2016 5:10 AM

Hi

I have a label on my webform which displays current system. I want to use the label displayed to mark automatically checkboxes if the time is greater than 9:30am.
 Below is my code but am having the following error message:

The best overload method match for system timespan(long) has some invalid arguments.
 
See my codes below:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      
         if (e.Row.RowType == DataControlRowType.DataRow)
    {
        CheckBox ChkBoxLate = e.Row.FindControl("ChkBoxLate") as CheckBox;
        TimeSpan time = TimeSpan.Parse(LblTimeNow.Text.Trim());
        TimeSpan timeToCompare = new TimeSpan(LblTimeNow);
        if (time > timeToCompare)
        {
            ChkBoxLate.Checked = true;
        }
    }
 
Thanks 

Answers (3)