We can format asp.net gridview rows on basis of data using C# helper method like this
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class FormateFieldInGridview : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public string FormatEmpSal(object objEmpSal) { if (objEmpSal.Equals(DBNull.Value.ToString())) { return "<span style='color: red; font-weight: bold;'>EmpSal is Blank</span>"; } else { decimal Sal = Convert.ToDecimal(objEmpSal); if (Sal <= 0) { return "<span style='color: red; font-weight: bold;'>EmpSal is Zero</span>"; } else { return Sal.ToString(); } } } }
In aspx bind this method like this
Nice One….