c# - Color GridView Expiration Date -



c# - Color GridView Expiration Date -

i "new" in c# programming , trying color date expire in few days or expired. code

sqlconnection cs2 = new sqlconnection(@"data source=.\sqlexpress;attachdbfilename=c:\\users\nikola\documents\visual studio 2010\projects\gym software\gym software\data.mdf;integrated security=true;connect timeout=30;user instance=true"); sda = new sqldataadapter("select datumistice korisnici", cs2); foreach (datagridviewrow row in datagridview1.rows) { var = datetime.now; var expirationdate = datetime.parse(row.cells[0].value.tostring()); var sevendaybefore = expirationdate.adddays(-7); if (now > sevendaybefore && < expirationdate) { row.defaultcellstyle.backcolor = color.yellow; } else if (now > expirationdate) { row.defaultcellstyle.backcolor = color.red; } }

the lastly row shoud colored, not:

how this:

row.backcolor = color.red;

c# asp.net gridview

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -