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

ComboBoxColumn automatic creation

3 Answers 54 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Giovanni Riccò
Top achievements
Rank 1
Giovanni Riccò asked on 23 Dec 2010, 11:07 AM
Hi,

how could I make a grid automatically create a ComboBoxColumn by giving it a BindingList of custom objects? The grid only detects decimal and datetime columns corresponding to object's properties of the same type, but for the remaining properties it creates TextBoxColumns. This is correct because these properties are string but the column's type should be ComboBoxColumn. I'm guessing if there's a way to change the column's type dinamically, but the explicit cast produces an exception.

Greetings,
Giovanni

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 11:41 AM
Hi,

As far as I'm aware, you cannot auto generate a column of this type. You need to define the column and give it the datasource, displaymember and value member properties. Please have a look at this documentation.

If you need more help, just let me know
Richard
0
Accepted
Giovanni Riccò
Top achievements
Rank 1
answered on 23 Dec 2010, 04:05 PM
Hi Richard,

the only solution seems to be adding columns manually.

Greetings,
Giovanni
0
Richard Slade
Top achievements
Rank 2
answered on 23 Dec 2010, 04:06 PM
Hi,

Yes, from my understanding, that's the case.
regards,
Richard
Tags
GridView
Asked by
Giovanni Riccò
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Giovanni Riccò
Top achievements
Rank 1
Share this question
or