Hi,
the cells of my SFDataGrid show me this "validation error":
"The input value is not a valid value for DevExpress.Xpo.XPCollection" when I try to select one of the object in a GridComboBoxColumn.
Example of this column:
sfDataGrid.Columns.Add(new GridComboBoxColumn()
{
MappingName = "Category",
HeaderText = "Category",
DisplayMember = "Name",
ValueMember = "Name",
DropDownStyle = DropDownStyle.DropDownList,
DataSource = dataSourceObjectSpace.GetObjects<Category>().ToList(),
ValidationMode = Syncfusion.WinForms.DataGrid.Enums.GridValidationMode.None
});
The Category property is one of the property of the "grid row object" Item.
The grid datasource is assigned like:
grid.DataSource = dataSourceObjectSpace.GetObjects<Item>();
Hi
Saverio
We are a little unclear
about your reported scenario. Please provide more information related to your
query?
It will be more helpful for us to check the possibilities for resolving the reported problem.
Hi,
in your attached example, instead of using "Ship Country" as a simple string type, try to create the same property as a "Country" class type (more logical structure, for an OOP language); in that case, the column data source would become a list of Country objects, no longer a list of string.
Furthermore, how can I associate an enum type property to a column instead?
Hi Saverio,
Find the response to the queries,
Query | Response |
in your attached example, instead of using "Ship Country" as a simple string type, try to create the same property as a "Country" class type (more logical structure, for an OOP language); in that case, the column data source would become a list of Country objects, no longer a list of string. | We have modified the ShipCountry type as a country class type and the GridComboBoxColumn DataSource as a country object. |
Furthermore, how can I associate an enum type property to a column instead? | You can set the enum type property to the GridComboBox column. |
Hi,
ok, I found how the enum columns works (I must create a new List of enums, populate it with the desired enums, and then assign to the desired column, strange behaviour, because I thought that was enough to assign directly the enum type to the "ColumnMemberType", but this is not the case, but ok, the important is that it works...), now I will try to resolve the first problem and I'll update you.
But I found another strange problem; the DateTime column crash the application (System.NullReferenceException), when I try to add a new row and then to edit it.
A sample of the column:
sfDataGrid1.Columns.Add(new GridDateTimeColumn()
{
MappingName = "Date",
HeaderText = "Data",
ColumnMemberType = typeof(DateTime),
Pattern = DateTimePattern.ShortDate,
AllowNull = true
});
Saverio,
Find the response to the queries,
Query |
Response |
ok, I found how the enum columns works (I must create a new List of enums, populate it with the desired enums, and then assign to the desired column, strange behaviour, because I thought that was enough to assign directly the enum type to the "ColumnMemberType", but this is not the case, but ok, the important is that it works...), now I will try to resolve the first problem and I'll update you.
|
Thanks for the update. Please test at your end. Also, please let us know if you require any further assistance on this. we will be happy to assist you. |
But I found another strange problem; the DateTime column crash the application (System.NullReferenceException), when I try to add a new row and then to edit it.
A sample of the column:
sfDataGrid1.Columns.Add(new GridDateTimeColumn() { MappingName = "Date", HeaderText = "Data", ColumnMemberType = typeof(DateTime), Pattern = DateTimePattern.ShortDate, AllowNull = true });
|
We
have created a new thread for the query, and the link is below. |