Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview Column colors

Gridview Column colors

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    codingrocks
    wrote on last edited by
    #1

    I have a gridview control in aspx page. Suppose I have 3 columns, I need to have different colors for each column. I want to set different colors for three different columns in the gridview. Is it possible to set the colors in aspx page. I have tried implementing, but could find any solution. Please suggest me a way to achieve this...

    CodingRocks ASP.NET,C#.NET Programmer BANGALORE "Winners don't do different things. They do things differently. ...

    P L 2 Replies Last reply
    0
    • C codingrocks

      I have a gridview control in aspx page. Suppose I have 3 columns, I need to have different colors for each column. I want to set different colors for three different columns in the gridview. Is it possible to set the colors in aspx page. I have tried implementing, but could find any solution. Please suggest me a way to achieve this...

      CodingRocks ASP.NET,C#.NET Programmer BANGALORE "Winners don't do different things. They do things differently. ...

      P Offline
      P Offline
      Prosanta Kundu online
      wrote on last edited by
      #2

      Set ItemStyle-BackColor property of BoundField

      <asp:BoundField ItemStyle-BackColor="Yellow" ....

      1 Reply Last reply
      0
      • C codingrocks

        I have a gridview control in aspx page. Suppose I have 3 columns, I need to have different colors for each column. I want to set different colors for three different columns in the gridview. Is it possible to set the colors in aspx page. I have tried implementing, but could find any solution. Please suggest me a way to achieve this...

        CodingRocks ASP.NET,C#.NET Programmer BANGALORE "Winners don't do different things. They do things differently. ...

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You can also change color of particular row or column at run time based on some condition. i.e.

        if(SomeCondition)
        {
        datagridview1.Columns[0].DefaultCellStyle.BackColor = Color.Aqua
        datagridview1.rows[3].DefaultCellStyle.BackColor = Color.Aqua
        }
        else
        {
        datagridview1.Columns[0].DefaultCellStyle.BackColor = Color.Blue
        datagridview1.rows[3].DefaultCellStyle.BackColor = Color.Blue
        }

        HTH

        Jinal Desai - LIVE Experience is mother of sage....

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups