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. Grid View

Grid View

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

    Hi All, I have a Gridview in my asp page. In first bound column I have Id field. I want this column to be invisible in Gridview but when I selecyt the row i should be able to get the value of that cell. I set the Column property Visible = False. and in my code behind page GridViewRow grow = gdProxy.Rows[gdProxy.EditIndex]; int proxyId = Convert.ToInt32(grow.Cells[0].Text); But it doesn't work but if I set Visible + true It works. But I don't want this column to be visible in my grid view but want to get the value of cell.

    seema

    E U 2 Replies Last reply
    0
    • S seemamltn

      Hi All, I have a Gridview in my asp page. In first bound column I have Id field. I want this column to be invisible in Gridview but when I selecyt the row i should be able to get the value of that cell. I set the Column property Visible = False. and in my code behind page GridViewRow grow = gdProxy.Rows[gdProxy.EditIndex]; int proxyId = Convert.ToInt32(grow.Cells[0].Text); But it doesn't work but if I set Visible + true It works. But I don't want this column to be visible in my grid view but want to get the value of cell.

      seema

      E Offline
      E Offline
      eggsovereasy
      wrote on last edited by
      #2

      They changed this in .net 2.0 so that the data in an invisible column is not accessible. What are you trying to do with the id? You can put it in the commandarugment property if you want to use it in a command button. Or use the DataFormatField and DataFormatString in a hyperlink column.

      1 Reply Last reply
      0
      • S seemamltn

        Hi All, I have a Gridview in my asp page. In first bound column I have Id field. I want this column to be invisible in Gridview but when I selecyt the row i should be able to get the value of that cell. I set the Column property Visible = False. and in my code behind page GridViewRow grow = gdProxy.Rows[gdProxy.EditIndex]; int proxyId = Convert.ToInt32(grow.Cells[0].Text); But it doesn't work but if I set Visible + true It works. But I don't want this column to be visible in my grid view but want to get the value of cell.

        seema

        U Offline
        U Offline
        Urs Enzler
        wrote on last edited by
        #3

        remove the column for id from the GridView and set the DataKeys property to "id". Then you can access the id with gridview.DataKeys[someIndex].Value

        -^-^-^-^-^- no risk no funk ................... please vote ------>

        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