Connecting Tech Pros Worldwide Forums | Help | Site Map

gridview custom no. column

Site Addict
 
Join Date: Feb 2007
Posts: 553
#1: Jun 23 '09
Hi

New to vb.net

I create a GridView. It has default three columsn. cant find the way to delete a colmn, i want only 1 column in it

how to do this from design view?

thanks
qi

Member
 
Join Date: Jun 2009
Posts: 33
#2: Jun 23 '09

re: gridview custom no. column


sounds like your using visual studio or web developer - are you?
how are you planning to feed the data into the grid (filling a dataset w code vs. creating a connection object)?
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,137
#3: Jun 26 '09

re: gridview custom no. column


Your GridView or DataGridView's columns are automatically added for you based on the DataSource that it's bound to.

When you bind the GrdiView or DataGridView to a data source, the data source's properties (if it's an Object) or columns (if it's a table) become the columns displayed for the GridView or DataGridView.

If you don't want certain columns to be displayed you have a couple of options.

The first one would be to modify the data source so that it only contains the columns/properties that you want displayed.

The second would be to modify the GridView or DataGridView itself. But before I can recommend how to do this I need to know, are you using an ASP.NET GridView or are you developing a desktop application and you're using the DataGridView?

-Frinny
Reply

Tags
gridview