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. General Programming
  3. Visual Basic
  4. How to suppress a column in datagrid? (vb.net 1.1)

How to suppress a column in datagrid? (vb.net 1.1)

Scheduled Pinned Locked Moved Visual Basic
questioncsharptutorial
5 Posts 4 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.
  • I Offline
    I Offline
    infotools
    wrote on last edited by
    #1

    I am using vb.net 1.1 for desktop application. While displaying contents of a datatable / dataview in a datagrid, I wish to suppress some columns (foreign keys, few admin fields) which user is not concerned with. how do I do it?

    thanks, Madhav

    E D D 3 Replies Last reply
    0
    • I infotools

      I am using vb.net 1.1 for desktop application. While displaying contents of a datatable / dataview in a datagrid, I wish to suppress some columns (foreign keys, few admin fields) which user is not concerned with. how do I do it?

      thanks, Madhav

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

      If you are using visual basic 2003 then you can use the following statement I think the styanx for hidding a column is like this. datatable.columns(0).columnmapping = Hidden

      I 1 Reply Last reply
      0
      • I infotools

        I am using vb.net 1.1 for desktop application. While displaying contents of a datatable / dataview in a datagrid, I wish to suppress some columns (foreign keys, few admin fields) which user is not concerned with. how do I do it?

        thanks, Madhav

        D Offline
        D Offline
        DigiOz Multimedia
        wrote on last edited by
        #3

        infotools wrote:

        While displaying contents of a datatable / dataview in a datagrid, I wish to suppress some columns (foreign keys, few admin fields) which user is not concerned with.

        You could build a query and only select the columns that you want to display using that query, before you bind the datatable to the grid, i.e: SELECT column1, column2, ... FROM [tableName] WHERE ...

        Pete Soheil DigiOz Multimedia http://www.digioz.com

        1 Reply Last reply
        0
        • I infotools

          I am using vb.net 1.1 for desktop application. While displaying contents of a datatable / dataview in a datagrid, I wish to suppress some columns (foreign keys, few admin fields) which user is not concerned with. how do I do it?

          thanks, Madhav

          D Offline
          D Offline
          Dayekh
          wrote on last edited by
          #4

          When the User Logs on, make sure his UserGroup is stored in a session variable i.e. Session("AccessGroup") = row("vchAccessGroupName") Then in the OnItemDatabound event for the datagrid: If Session("AccessGroup") <> "Admin" Then e.Item.Cells(x).Visible = False //////x being the index of the column in the html End If That's all really. Hope this helps.

          1 Reply Last reply
          0
          • E ejaz_pk

            If you are using visual basic 2003 then you can use the following statement I think the styanx for hidding a column is like this. datatable.columns(0).columnmapping = Hidden

            I Offline
            I Offline
            infotools
            wrote on last edited by
            #5

            Hello, Thanks for indicating the way. Actual code is tblMaster.Columns("Id").ColumnMapping = MappingType.Hidden tblMaster.Columns("IsBillable").ColumnMapping = MappingType.Hidden where "tblMaster" is datatable, it does work and seems to be correct way of doing this. Now I am trying to see how the hidden columns will be updated when foreign key values change due to change in name/description of foreign key or when a new record is added. I will post the concerned code when I check it thoroughly. thanks once again.

            thanks, Madhav

            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