I can't to style last row of Gridview text into Bold.
With this code on RowDataBound event I can give a different background color on last row of Gridview.
How to style last row of Gridview text into Bold ?
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (((string)DataBinder.Eval(e.Row.DataItem, "sName")).Equals("TOT"))
{
e.Row.BackColor = Color.Gainsboro;
e.Row.Font.Bold = true;
e.Row.Font.Italic = true;
}
}
}
Use PreRender event for styling the row and use grdAlert.Rows[GridView1.Rows.Count - 1]
to find last row:
protected void GridView_PreRender(object sender, EventArgs e)
{
GridViewRow LastRow = grdAlert.Rows[GridView1.Rows.Count - 1];
LastRow.BackColor = Color.Gainsboro;
LastRow.Font.Bold = true;
LastRow.Font.Italic = true;
}