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. Data Grid Columns

Data Grid Columns

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

    Can I make one of the column of my datagrid invisible?? My data grid's datasource is dataview. Me.DataGrid1.DataSource = .retrivecomm() Me.DataGrid1.DataBind() Public Function retrivecomm() As System.Data.DataView Dim con As New OleDb.OleDbConnection con.ConnectionString =Trim(ServerPath.KMSCONNECTIONSTRING) con.Open() Dim COMMDA As OleDb.OleDbCommand = New OleDb.OleDbCommand("select * from TABLE", con) Dim COMMDR As OleDb.OleDbDataReader COMMDR = COMMDA.ExecuteReader(CommandBehavior.CloseConnection) Dim dt As New DataTable Dim dr As DataRow Dim i As Integer dt.Columns.Add(New DataColumn("Code", GetType(String))) dt.Columns.Add(New DataColumn("Description", GetType(String))) dt.Columns.Add(New DataColumn("Color", GetType(Double))) Do While COMMDR.Read() dr = dt.NewRow() dr(0) = COMMDR.GetString(0) dr(1) = COMMDR.GetString(1) dr(2) = COMMDR.GetString(2) dt.Rows.Add(dr) Loop Dim dv As New DataView(dt) retrivecomm = dv COMMDR.Close() COMMDA.Dispose() con.Dispose() End Function I want hide the third column i.e. Color column Chintan

    M 1 Reply Last reply
    0
    • C chintan1979

      Can I make one of the column of my datagrid invisible?? My data grid's datasource is dataview. Me.DataGrid1.DataSource = .retrivecomm() Me.DataGrid1.DataBind() Public Function retrivecomm() As System.Data.DataView Dim con As New OleDb.OleDbConnection con.ConnectionString =Trim(ServerPath.KMSCONNECTIONSTRING) con.Open() Dim COMMDA As OleDb.OleDbCommand = New OleDb.OleDbCommand("select * from TABLE", con) Dim COMMDR As OleDb.OleDbDataReader COMMDR = COMMDA.ExecuteReader(CommandBehavior.CloseConnection) Dim dt As New DataTable Dim dr As DataRow Dim i As Integer dt.Columns.Add(New DataColumn("Code", GetType(String))) dt.Columns.Add(New DataColumn("Description", GetType(String))) dt.Columns.Add(New DataColumn("Color", GetType(Double))) Do While COMMDR.Read() dr = dt.NewRow() dr(0) = COMMDR.GetString(0) dr(1) = COMMDR.GetString(1) dr(2) = COMMDR.GetString(2) dt.Rows.Add(dr) Loop Dim dv As New DataView(dt) retrivecomm = dv COMMDR.Close() COMMDA.Dispose() con.Dispose() End Function I want hide the third column i.e. Color column Chintan

      M Offline
      M Offline
      Marcie Jones
      wrote on last edited by
      #2

      Hi Chintan, If you're specifying each column individually in the [Columns] section of your [asp:Datagrid], then you can hide them with this: DataGrid1.Columns(2).Visible = False For AutoGeneratedColumns, it's a bit more complicated, but I have a sample available here. Hope that helps, Marcie CP Blog[^]

      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