c# - How to change the color for entire GridView row -
protected void yourtasksgv_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { system.web.ui.webcontrols.imagebutton btnshowdepend = e.row.findcontrol("btnshowdepend") system.web.ui.webcontrols.imagebutton; if (!string.isnullorempty(e.row.cells[5].text)) { if (datetime.parse(e.row.cells[5].text).date < datetime.now.date) { e.row.cells[5].forecolor = color.fromname("#c00000"); e.row.cells[5].tooltip = "task past due"; //instead of column per row, set every row matches condition color } else if (datetime.parse(e.row.cells[5].text).date <= datetime.now.adddays(indateoffset).date) { e.row.cells[5].forecolor = color.fromname("#dca704"); e.row.cells[5].tooltip = "task @ risk"; //instead of column per row, set every row matches condition color } else { e.row.cells[5].tooltip = "task not due yet"; } } } }
instead of changing color of specific column in row using date function, how set entire row?
row has forecolor , tooltip properties well. do
if (datetime.parse(e.row.cells[5].text).date < datetime.now.date) { e.row.forecolor = color.fromname("#c00000"); e.row.tooltip = "task past due"; }
Comments
Post a Comment