Hello every body.
I have a RadGridView directly bound to a Ado.Net Entity. Maybe that's not best practice but I have to.
That entity have a property that does not allow null values:
[EdmScalarPropertyAttribute(EntityKeyProperty=
false
, IsNullable=
false
)]
[DataMemberAttribute()]
public
global::System.String VCOCDC
{
get
{
return
_VCOCDC;}
set
{
OnVCOCDCChanging(value);
ReportPropertyChanging(
"VCOCDC"
);
_VCOCDC = StructuralObject.SetValidValue(value,
false
);
ReportPropertyChanged(
"VCOCDC"
);
OnVCOCDCChanged();
}
}
That property is bound to a GridViewComboBoxColumn:
<
telerik:GridViewComboBoxColumn
Header
=
"{x:Static resc:Resources.Voce}"
Width
=
"200"
DisplayMemberPath
=
"VCODSC"
SelectedValueMemberPath
=
"VCOCDC"
DataMemberBinding
=
"{Binding VCOCDC}"
Name
=
"cl_VCOCDC"
IsGroupable
=
"False"
IsComboBoxEditable
=
"False"
/>
When inserting a new row on the grid (BeginInsert()), if the user leaves the current row without to choose a value on the combobox , an exception is raised at the row:
_VCOCDC = StructuralObject.SetValidValue(value, false);
I can't capture the exception, unless i set a global handler, but even so, I would not know what to do, so the application quit.
Questions:
How can I prevent this exception and enforce the user to select a correct value or she can't leave the field? I tried the RowValidating event but that exception is fired before the RowValidating event is raised.
Best Regards