Reputation: 6056
I am having a ComboEdit control in my WPF application which is binded by Entity named with 'Contacts'. now i want to ge the selected value of ComboEdit.
<dxe:ComboBoxEdit Name="ddlFirstName" HorizontalAlignment="Left" Margin="125,24,0,0" VerticalAlignment="Top" Width="140" SelectedIndexChanged="ddlFirstName_SelectedIndexChanged"/>
protected void BindAllDropdown()
{
ddlFirstName.ItemsSource = BLL.GetAllContacts();
ddlFirstName.DisplayMember = "FirstName";
ddlFirstName.ValueMember = "ContactID";
ddlLastName.ItemsSource = BLL.GetAllContacts();
ddlLastName.DisplayMember = "LastName";
ddlLastName.ValueMember = "ContactID";
}
i am trying to get selected value on selected index change event using:
string contid = ddlFirstName.SelectedItem.ToString();
this returns whole entity so not able to get the selected value. how to get the selected value?
Help appreciated! Thanks!
Upvotes: 1
Views: 3487
Reputation: 17850
Use the ComboBoxEdit.EditValue property:
void ComboBoxEdit_EditValueChanged(object sender, EditValueChangedEventArgs e) {
string contid = cb.EditValue.ToString();
}
Upvotes: 2