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. invisible..

invisible..

Scheduled Pinned Locked Moved ASP.NET
visual-studiohelpquestion
2 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.
  • L Offline
    L Offline
    locaas
    wrote on last edited by
    #1

    hy i habve a datagrid and i wanth to make some columns invisible and "Datagrid.Columns(2).visible = False" isn't working.. Can someone tell me why or show me another way 2 do this? i am using vs 2005 plz help 10x

    K 1 Reply Last reply
    0
    • L locaas

      hy i habve a datagrid and i wanth to make some columns invisible and "Datagrid.Columns(2).visible = False" isn't working.. Can someone tell me why or show me another way 2 do this? i am using vs 2005 plz help 10x

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #2

      I usually do this in the GridView's RowDataBound event. (Or if you are indeed using a DataGrid instead of the GridView it is the ItemDataBound event. Personally, I don't use the old DataGrid objects anymore.) For a GridView the code would look something like this:

      Protected Sub GridView1\_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
          Select Case e.Row.RowType
              Case DataControlRowType.DataRow
                  e.Row.Cells(0).Visible = False
          End Select
      End Sub
      

      In this example I am hiding the first column in the grid only. If you need to hide another you would need to know the column index and add another statement like this: e.Row.Cells(index).Visible = False Hope this helps.

      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