Search This Blog

Monday, January 10, 2011

Change text in CELL of gridview to bold based on data

Some times we need to make the gridview cell text into bold based on the data from database. By the time we can use the code like the following to make the cell text as bold and can use it.


protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)
   
{
       
if (e.Row.RowType == DataControlRowType.DataRow)
       
{
           
if (e.Row.Cells[0].Text.Contains("sometext"))
           
{
                e
.Row.Cells[0].Font.Bold = true;
           
}
       
}
   
}
 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.