This question is locked. New answers and comments are not allowed.
Situation:
The entity ppl_language has a few properties. One of them would be the defLanguage, (represents another entity called defLanguage, not nullable). The other is idLanguage which is the foreign key. The grid is bound to ppl_languages, which is a ObservableCollection of ppl_language.
The items source of the combobox column is set in the data loaded event - it is binding to a ObservableCollection of DefLanguage
The issue is since ppl_language. is not nullable, some item must be selected in the combobox. However, when the combobox is empty it will only return the error message "input in not in a correct format".
Metadata for ppl_language
The custom validator should return the proper error message, but I put a break point in the custom validator and the code is only run AFTER I select something in the combobox - when nothing is selected the validator is not used at all and just return the incorrect format error.
The entity ppl_language has a few properties. One of them would be the defLanguage, (represents another entity called defLanguage, not nullable). The other is idLanguage which is the foreign key. The grid is bound to ppl_languages, which is a ObservableCollection of ppl_language.
The items source of the combobox column is set in the data loaded event - it is binding to a ObservableCollection of DefLanguage
<
telerik:RadGridView
ItemsSource
=
"{Binding ppl_languages}"
Grid.Row
=
"12"
Grid.ColumnSpan
=
"2"
CanUserInsertRows
=
"True"
CanUserDeleteRows
=
"true"
ShowInsertRow
=
"True"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
ShowGroupFooters
=
"False"
DataLoaded
=
"gdvLanguage_DataLoaded"
telerik:StyleManager.Theme
=
"Windows7"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewComboBoxColumn
Header
=
"Language"
DisplayMemberPath
=
"desc1"
SelectedValueMemberPath
=
"idLanguage"
DataMemberBinding
=
"{Binding idLanguage}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
The issue is since ppl_language. is not nullable, some item must be selected in the combobox. However, when the combobox is empty it will only return the error message "input in not in a correct format".
Metadata for ppl_language
[Include]
[Display(Name = "Language", Description = "Language")]
[Association("ppl_language_defLanguage", "idLanguage
", "idLanguage
", IsForeignKey = true)]
public defLanguage defLanguage { get; set; }
[CustomValidation(typeof(PplLanguageValidator), "ValidateHasLanguage")]
public int idLanguage { get; set; }
The custom validator should return the proper error message, but I put a break point in the custom validator and the code is only run AFTER I select something in the combobox - when nothing is selected the validator is not used at all and just return the incorrect format error.