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. Find column in a grid by name

Find column in a grid by name

Scheduled Pinned Locked Moved ASP.NET
questioncss
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.
  • R Offline
    R Offline
    ravihd
    wrote on last edited by
    #1

    How do I find a column in a grid by the name of the column? I find I'm constantly having to change the cell numbers because the order of the columns in the grid changes. Thanks

    V I 2 Replies Last reply
    0
    • R ravihd

      How do I find a column in a grid by the name of the column? I find I'm constantly having to change the cell numbers because the order of the columns in the grid changes. Thanks

      V Offline
      V Offline
      varshavmane
      wrote on last edited by
      #2

      Hi U can use IndexOf and SubString.U will get the column name by this. If u want the code then Ill send it. Regards. -- modified at 9:13 Wednesday 8th March, 2006

      1 Reply Last reply
      0
      • R ravihd

        How do I find a column in a grid by the name of the column? I find I'm constantly having to change the cell numbers because the order of the columns in the grid changes. Thanks

        I Offline
        I Offline
        Ista
        wrote on last edited by
        #3

        You should be setting the DataSource property of the Gid to your DataTable.DefaultView. Just access the DataView instead of direclty on the table. This will solve your dilemna 1 line of code equals many bugs. So don't write any!!

        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