private void btnSave_Click(object sender, EventArgs e) { CaseRecord.PersonLast = tbPersonLast.Text; CaseRecord.PersonFirst = tbPersonFirst.Text;
CaseRecord.CaseStatusID = cboCaseStatus.SelectedPicklistNullableID();//this is a required combobox field, vaildation works fine.
CaseRecord.CaseTypeID = cboCaseType.SelectedPicklistID();
public static int? SelectedPicklistNullableID(this ComboBox cb) { if (cb.SelectedItem == null) return null; return ((PickListItem)cb.SelectedItem).ID; } public static int SelectedPicklistID(this ComboBox cb) { return cb.SelectedPicklistNullableID().Value; } In my DAL and BLL clases, I have nullable comboboxID's for the nullable comboboxes.How do I get my comboboxes to return null, when no item is selected. Thank you.