In this blog we will know how to change the grid view row
color according to some given conditions.
Scenario
I have a Dropdown list
with two items that is "Important" and "Very Important" and
a textbox for 'short note'. I have saved those to database. I want the data to
load on grid view but with colored row. I mean for the data that is
'Important' i want the row to be colored 'blue' and for the data that is
'very important' i want the row to be colored 'red'.
using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; using System.Drawing; public partial class _Default : System.Web.UI.Page { string connStr =
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlCommand com; SqlDataAdapter sqlda; DataSet ds; string str;
Join the conversation! Your thoughts help the community grow.