I have binded the Grid to the Datasource using the Designer , there i selected the number of columns to be displayed but on giving the adapter.fill method , it returns all the columns
Hello Linija,
When binding a DataSource to a Grid through designer, if you have selected specific columns then the DataAdapter.Fill method will only render those columns in the Grid. I have tested this behavior and it is working like I described. In order to resolve this issue, try calling the below line of code to clear the DataAdapter before filling it:
this.categoriesTableAdapter.ClearBeforeFill = true;
Please try the above suggestion and let me know if I may be of further assistance.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
Hello Sahaja
Thanks for the update , but the problem still exists, please see the attachment . I really dont understand where the problem is.
I have tried the second method binding the grid to sp , still it returns all columns.Please see the attachment
Did you read the article I posted and make sure that your layout matches the data source you bind to at run-time? The most common mistake people make is forgetting to set the Key on the band. If it doesn't match, then the grid's layout will be lost at run-time.
Is this the one you are refering to ?
Please see the attachment
At design time , only my specified columns appear but on run time the unspecified columns start after the specified columns
It looks like you are editing the Columns collection of the band via the property grid. That won't work. You have to use the grid designer and manually define the schema. If you follow the instructions in the KB article I posted above, it walks you through it step by step.