Posted on: 1/21/2015 1:03:49 PM | Views : 576

I am trying to create a row bound event, where I extract date from the label (label10) as expiry date and work out the difference between datetime.now and expDate, which equals the remaining days.  
I would like to add the remaining days into the new column (i.e. newCol) and then if newCol days is either less than or equal to 2, it would highlight that specific rows in red.  I am little unclear, how to go about returning the output from the date range difference and into the newCol. 
Here is my attempt so far:
public void yourGridview_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label newCol = (Label)GridView1.Rows[(0)].FindControl("Label11"); Label expDate = (Label)GridView1.Rows[(0)].FindControl("Label10"); TimeSpan days; ...

Go to the complete details ...