Avatar of Crazy_Penguins
Crazy_Penguins

asked on 

GridView Columns

Basic setup - I have a text box, drop-down, and a button the user should use to search a database with.  

From there, the adapter returns results, with all the fields in the database for customers.

Now, with that said, how to I only display specific fields?  I know you can modify some settings in the GUI for the GridView, however I only know how to do that if I also use the GUI to set the data source.  (and the code below works great for what I want to do, and really don't want to change it - just add to it)
Dim ClientAdapter As New RMSTableAdapters.CustomersTableAdapter
 
        If Me.DropDownSearchBy.SelectedValue = "Email" Then
            Me.GridViewResults.DataSource = ClientAdapter.GetDataByFindByEmail(Me.TxtSearch.Text)
        ElseIf Me.DropDownSearchBy.SelectedValue = "LName" Then
            Me.GridViewResults.DataSource = ClientAdapter.GetDataByFindByLName(Me.TxtSearch.Text)
        ElseIf Me.DropDownSearchBy.SelectedValue = "FName" Then
            Me.GridViewResults.DataSource = ClientAdapter.GetDataByFindByFName(Me.TxtSearch.Text)
        End If
 
        Me.GridViewResults.DataBind()

Open in new window

ASP.NET

Avatar of undefined
Last Comment
Crazy_Penguins

8/22/2022 - Mon