I have a radgridview with 3 columns, one of which is a gridviewlookupcolumn.
The data is populated using LinqToSql classes as followingf
DataClasses2DataContext
dcl = new DataClasses2DataContext();
GridViewLookUpColumn gvc = new GridViewLookUpColumn("SuitabilityIndex1");
radGridView1.DataSource = dcl.USBDevices;
radGridView1.Columns[
"Id"].IsVisible = false;
radGridView1.Columns[
"SuitabilityIndex"].IsVisible = false;
radGridView1.Columns[
"Manufacturer"].StretchVertically = true;
System.Collections.Generic.
List<short> dd = new List<short>();
dd.Add(0);
dd.Add(1);
dd.Add(2);
gvc.DataSource = dd;
radGridView1.Columns.Add(gvc);
radGridView1.Columns[
"SuitabilityIndex1"].FieldName = "SuitabilityIndex";
The field SuitabilityIndex in the database is smallInt that allows null. The datasource for the lookup column is short
When I change the value in the lookup column, it fires the data error event with the following error
{Telerik.WinControls.UI.GridViewDataErrorEventArgs}
base {Telerik.WinControls.UI.GridViewCellCancelEventArgs}: {Telerik.WinControls.UI.GridViewDataErrorEventArgs}
Context: Commit
Exception: {"Object of type 'System.String' cannot be converted to type 'System.Nullable`1[System.Int16]'."}
ThrowException: false
I think the problem is that the lookupcolumn thinks that the datatype os string. I can say that for sure since the allignmnet of values on the grid are to the left and not to the right.
I tried setting the datatype of the column to short, but did not help
Thanks
Deepak