I am displaying my data in a devexpress gridview. One of the column is state value. When the grid is edited, I have to show the state in a combobox, so that the user could change the state by choosing a different state. Currently it is displayed in a textbox, since it is the default. Essentially when the user clicks the edit button, a combobox should be displayed as part of the edit controls, and the combobox should be populated with all possible states in the codebehind and the selected value should be the initial value on the grid. It is very easy do it in MS gridview. But I couldn't see any sample code for how to do it in the devexpress gridview.
Chat Now Cart My Downloads Free Trial Log In. General Information: WinForms Controls: ASP.NET Controls and MVC Extensions. Apr 7, 2012 - GridViewDataComboBoxColumn FieldName='QAAproval'. You can also take a look at DevExpress grid editing demos.
Thanks
user466663user466663
5 Answers
You'll need to set the datasource so you'll get the list of values
GuruparanGuruparan
If you don't have a data source and want to include the combo box items in your code, here's another way to create the column:
Maximus56Maximus56
Edit the GridView Template, and in the EditTemplate of the field, add the dropdownbox. It might come to look like this
![Demo Demo](https://documentation.devexpress.com/HelpResource.ashx?help=AspNet&document=img1853074.jpg)
So when you edit that row, it will show the DDL
CJLopezCJLopez
Use GridViewDataComboBoxColumn. Declare datasource and attach it to combo box column or populate it in code behind. This example contains both variants.
You can also take a look at DevExpress grid editing demos.
You can also take a look at DevExpress grid editing demos.
![Devexpress Devexpress](http://i.imgur.com/NZnVwAA.png)
FilipFilip
I have used the following code to have combo box in the aspxgridview.
I hope this example helps :
RuchiRuchi
Not the answer you're looking for? Browse other questions tagged asp.netcomboboxdevexpressaspxgridview or ask your own question.
Files to look at:
- PersonObject.cs (VB: PersonObject.vb)
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
When GridViewDataComboBoxColumn uses complex properties, it is necessary to define the following properties:
- GridViewDataComboBoxColumn.FieldName - Object.ID;
- PropertiesComboBox.TextField - an object's name;
- PropertiesComboBox.ValueField - an object's ID;
- PropertiesComboBox.ValueType should be set according to the Data Type Mappings (ADO.NET) table.
- GridViewDataComboBoxColumn.FieldName - Object.ID;
- PropertiesComboBox.TextField - an object's name;
- PropertiesComboBox.ValueField - an object's ID;
- PropertiesComboBox.ValueType should be set according to the Data Type Mappings (ADO.NET) table.
See also:
How to show a complex property value in a column's DataItemTemplate
ASPxGridView - How to bind GridViewDataComboBoxColumn at runtime
How to show a complex property value in a column's DataItemTemplate
ASPxGridView - How to bind GridViewDataComboBoxColumn at runtime