Hiding columns in GridView Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have binded a dataset to a gridview control at run time.
I'm fetching 5 columns from the database.
But while displaying it on the screen i want to show only 3 columns.
I tried with gridview.columns(i).visible property,but it did't work.

Thanks in advance
Srinivas
 
Hi,
Thanks for the response.
I DID NOT ADD ANY COLUMNS TO THE GRID VIEW AT DESIGN TIME OR AT RUN TIME.
In the codebehind i'm just setting the datasource of the grid view as
dataset which contains 5 columns of data.I require all 5 columns of data ,
but while displaying it i want to hide some columns.

Thanks
Srinivas
 
Hi Winista
Thanks for the URL.
But i'm using ASP.net gridview.
The code that;s given in that url does't fit for it.

Thanks
Srinivas
 
The same approach works for GridView. GridView also has RowDataBound and
RowCreated events and you will use the same technique to remove the cell
from row.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top