I can't found solution... i have set 4 columns in DataGrid view but when i am using SqlDatAdapter and DataTable it displaying all columns .
I have 10 columns in table, but i want to display only 4 columns in datagrid in c#, how can i do it?
545 Views Asked by Roop At
3
There are 3 best solutions below
0

What Babak Naffas said and you need to define your columns of the items that you want to show instead...
see: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.aspx
There is an example toward the end of the article that show how to do this.
This happens when the AutoGenerateColumns property is set to true (which is the default value). To turn it off, set AutoGenerateColumns to false.
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autogeneratecolumns.aspx