• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

ASP.net hide last column of bvound GridView (VB.net)

Hi

In ASP.net I bind data to my GridView using the code below. How do I hide the last column
(there are three columns)
If Not IsPostBack Then

            ' Declare the query string.

            Dim queryString2 As String = _
  "Select * From Questions"

            ' Run the query and bind the resulting DataSet
            ' to the GridView control.
            Dim ds2 As DataSet = GetData(queryString2)
            If (ds2.Tables.Count > 0) Then

                Me.GridView2.DataSource = ds2
                Me.GridView2.DataBind()

            Else

                'Me.Label_Error1.Text = "Unable to connect to the database. " & Err.Description

            End If

Open in new window

0
Murray Brown
Asked:
Murray Brown
  • 2
1 Solution
 
jppintoCommented:
did you tryed like this?

GridView2.Columns(2).Visible = False

0
 
jppintoCommented:
Or like this:

GridView1.Columns.Item(2).Visible = False
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
thanks very much
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now