Hi folks,
i have question here that, how to make font as bold in last column of gridview.
here, i have total 9 columns in grid as 2010, 2011 ,2012, 2010, 2011 ,2012, 2010, 2011 ,2012
but, here i have different header names as A for first 3 columns , B for second 3 columns ,C for last 3 columns.
finally, i want to make font as bold for entire 2012 column of C header.how to do ?.
please respond ASAP
Regards
Ravi Gaddam
Loading
Sunny SharmaPosted Jun 13, 2013, 3:26 PM
To achieve this purpose you will have to add these codes to RowDataBound event of GridView:
------------------------------------------------------------
protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
for (int i = 0; i < grd.Columns.Count; i++)
{
if (grd.Columns[i].HeaderText == "C")
{
row.Cells[i].Font.Bold = true;
}
}
}
------------------------------------------------------------
Please don't forget to mark this as answer if it helps!
Happy Coding :)
Ravi gaddamPosted Jun 14, 2013, 2:02 AM
Jignesh TrivediPosted Jun 13, 2013, 11:15 PM
hi,
you can also use column 's ItemTemplate to change font style.
please refer
http://msdn.microsoft.com/en-us/library/aa479353.aspx
http://msdn.microsoft.com/en-us/library/bb288032.aspx
hope this will help you.