Protected Sub gvGeneral_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvGeneral.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If previousExpenseType <> e.Row.Cells(2).Text And previousExpenseType.Length > 0 Then
e.Row.CssClass += "bottom-border"
End If
previousExpenseType = e.Row.Cells(2).Text
End If
End Sub
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridView grid = GridView1;
GridViewRow row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
bool isAlternating = row.RowState == DataControlRowState.Alternate;
List classes = new List();
/* Setting the CssClass of a row overwrites any CssClass declared in the
* markup, so lets save the value that is in the markup and add to it.
*/
if (isAlternating) { classes.Add(grid.AlternatingRowStyle.CssClass); }
else { classes.Add(grid.RowStyle.CssClass); }
//
//logic for adding other css classes to the row...
//
//set the CssClass property of the row to the combined css classes value
row.CssClass = string.Join(" ", classes.ToArray());
//
//more row processing...
//
}
}