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. GridView column visible property

GridView column visible property

Scheduled Pinned Locked Moved ASP.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.
  • K Offline
    K Offline
    kalyanPaladugu
    wrote on last edited by
    #1

    I have a GridView in my Web page. For one of the columns i set visible = false. I looped through the rows in the GridView and tried to get the value for the column for which the visible property is false and i got an empty string. When i set the visible property to true i was able to retrieve the value. Is this the normal behaviour of the GridView or am i doing any thing wrong here. Is there a way to get the value for a particular cell even though the visible property is false Thanks Kal

    M 1 Reply Last reply
    0
    • K kalyanPaladugu

      I have a GridView in my Web page. For one of the columns i set visible = false. I looped through the rows in the GridView and tried to get the value for the column for which the visible property is false and i got an empty string. When i set the visible property to true i was able to retrieve the value. Is this the normal behaviour of the GridView or am i doing any thing wrong here. Is there a way to get the value for a particular cell even though the visible property is false Thanks Kal

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      AFAIK, this behaviour is by design, and you have a couple of options to work around: + Don't use Visible property, use stylesheet to hide the column. + Save the value of the insivible column somewhere else like the DataKeys collection of the GridView.

      N 1 Reply Last reply
      0
      • M minhpc_bk

        AFAIK, this behaviour is by design, and you have a couple of options to work around: + Don't use Visible property, use stylesheet to hide the column. + Save the value of the insivible column somewhere else like the DataKeys collection of the GridView.

        N Offline
        N Offline
        Naveed Kamboh
        wrote on last edited by
        #3

        Hi Dear, If you use RowDataBound event of gridveiw i=0,1,2.... [column number] if (e.Row.RowType==DataControlRowType.Header ||e.Row.RowType==DataControlRowType.DataRow) e.Row.Cells[2].Visible = false; it will hide the column and you can use column value in your project there wont be any problem. if you need further help just email me. thanks

        Naveed Kamboh

        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