How to make the datagridview line text in bold when I pick a row?

后端 未结 4 2109
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-20 10:18

How do I make the datagridview line text in bold when I pick a row?

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-20 10:51

    The below code will make the font under Bold style for the selected row. "Total" is the last row check in my code

    protected void gvRow_RowDataBound(object sender, GridViewRowEventArgs e)
    {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
      if (e.Row.Cells[rowIndex].Text == "Total") 
      {
       e.Row.Font.Bold = true;
      }
     }
    }
    

提交回复
热议问题