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
  1. Home
  2. Web Development
  3. ASP.NET
  4. manually set backcolor of header in datagrid..help

manually set backcolor of header in datagrid..help

Scheduled Pinned Locked Moved ASP.NET
helpcssdatabasequestion
3 Posts 2 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
    cavall
    wrote on last edited by
    #1

    I have manually created a dataset, populated a datagrid with that dataset, and I want to change the background color of certain headerstyles for certain columns. I am trying to do it this way: datagrid.columns(0).HeaderStyle.BackColor = Color.Green I always get this error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Does anyone know what process I need to go about in order to be able to do this? THanks Cavall "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson

    S 1 Reply Last reply
    0
    • C cavall

      I have manually created a dataset, populated a datagrid with that dataset, and I want to change the background color of certain headerstyles for certain columns. I am trying to do it this way: datagrid.columns(0).HeaderStyle.BackColor = Color.Green I always get this error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Does anyone know what process I need to go about in order to be able to do this? THanks Cavall "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson

      S Offline
      S Offline
      Steven Campbell
      wrote on last edited by
      #2

      It sounds like you are using the "create columns automatically at run time" feature of the data grid. Your code should work if you pre-define the columns manually.


      my blog

      C 1 Reply Last reply
      0
      • S Steven Campbell

        It sounds like you are using the "create columns automatically at run time" feature of the data grid. Your code should work if you pre-define the columns manually.


        my blog

        C Offline
        C Offline
        cavall
        wrote on last edited by
        #3

        I am using the "creat auto..." feature.... So I have to predefine the entire datagrid before hand in order to manually manipulate its properties? I was under the impression that after the datagrid was binded to the dataset and created that I could manipulate it from there. Thanks Cav "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson

        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