This is a migrated thread and some comments may be shown as answers.

Confusion LinqToSql and Columns

1 Answer 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James Atherton
Top achievements
Rank 1
James Atherton asked on 11 Sep 2009, 12:32 PM
I set up a datagridview, it contains 6 columns, 2 buttons, 2 fields, and 2 comboboxes, when I link the LinqToSql datasource to the datagridview's datasource it loads the fields I defined, and then appends all the fields in the database table to it as well dynamically.  Any thoughts on why this might be happening, and more importantly, how do I fix it?

Thank you in advance,
Jim

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 14 Sep 2009, 01:03 PM
Hello James Atherton,

By default, AutoGenerateColumns of MasterGridViewTemeplate is set to true and when you bind a grid columns are generated. In your scenario - to stop this automatic generation - you must add the following snippet before you bind to a LinqToSql data source:

this.radGridView1.MasterGridViewTemplate.AutoGenerateColumns = false

Best wishes,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
James Atherton
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or