Change GridView row color based on condition

前端 未结 7 1016
时光说笑
时光说笑 2020-12-01 14:04

I want to change a particular row color of gridview based on some condition, I am using ASP.NET with c#. Thank you.

7条回答
  •  悲哀的现实
    2020-12-01 14:15

    Create GridView1_RowDataBound event for your GridView.

    //Check if it is not header or footer row
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        //Check your condition here
        If(Condition True)
        {
            e.Row.BackColor = Drawing.Color.Red // This will make row back color red
        }
    }
    

提交回复
热议问题