VB.net color code gridview

Hi

In VB.net is it possible to color different columns or cells?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
Pratima PharandeConnect With a Mentor Commented:
Here Sample code try this,Let 4 is cell number



 protected void GridviewName_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.Cells[4].Text == "Closed")
            {
 
                e.Row.Cells[4].ForeColor = Color.Green;
 
            }
            if (e.Row.Cells[4].Text == "Open")
            {
 
                e.Row.Cells[4].ForeColor = Color.Red;
 
            }
}
0
 
DhaestConnect With a Mentor Commented:
For webbased gridview

GridView Examples for ASP.NET 2.0: Formatting the GridView
http://msdn.microsoft.com/en-us/library/aa479342.aspx
0
 
DhaestCommented:
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Wow that was fast. Great answers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.