Hi
I'm a bit new to this but am having a problem with a combo column I have added. It seems to work fine (TextField value is showing in grid, filter dropdown is displaying TextValue values and filtering is working), until I go to edit a row.
When I do the dropdown in the edit form shows the guid value as selected, selecting any other value will fix the problem, it will show the Text of whatever item I select, clicking save will also work and update the grid field with the new value. If I hit edit again (on this or any other row) the guid is shown again.
Problem as seen when clicking edit
Markup for the column looks like this:
<dxwgv:GridViewDataComboBoxColumn FieldName="RoleId"
VisibleIndex="2" Caption="<%$ Resources: GridColumn.Role.Title %>">
<PropertiesComboBox ValueType="System.Guid" ValueField="RoleId" TextField="RoleName">
<ValidationSettings>
<RequiredField IsRequired="True" />
</ValidationSettings>
</PropertiesComboBox>
</dxwgv:GridViewDataComboBoxColumn>
And the datasource for the combo is set during DataBinding like so:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ASPxGridView1.DataBinding += new EventHandler(ASPxGridView1_DataBinding);
ASPxGridView1.RowInserting += new DevExpress.Web.Data.ASPxDataInsertingEventHandler(ASPxGridView1_RowInserting);
ASPxGridView1.RowUpdating += new DevExpress.Web.Data.ASPxDataUpdatingEventHandler(ASPxGridView1_RowUpdating);
}
void ASPxGridView1_DataBinding(object sender, EventArgs e)
{
GridViewDataComboBoxColumn column = ((GridViewDataComboBoxColumn)(sender as ASPxGridView).Columns["RoleId"]);
column.PropertiesComboBox.DataSource = (List<RoleInfo>)Session["RoleComboBoxDataSource"];
column.PropertiesComboBox.TextField = "RoleName";
column.PropertiesComboBox.ValueField = "RoleId";
}
Not sure whether it makes a difference but the grid itself is also populated without a DataSourceID:
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
}
public void DataBind()
{
if (Session["GroupList"] == null) GetDataSource();
List<GroupInfo> list = (List<GroupInfo>)Session["GroupList"];
ASPxGridView1.DataSource = list;
ASPxGridView1.KeyFieldName = "GroupId";
ASPxGridView1.AutoGenerateColumns = true;
ASPxGridView1.EnableRowsCache = false;
ASPxGridView1.DataBind();
}