Iam Ajay

Iam Ajay

  • NA
  • 11
  • 4.3k

Combobox selected text not getting saved

Apr 5 2013 2:19 AM
I want to save the selected value from the combobox that is the text inside the combobox in database.
but the Id is getting saved in database.

The table name is Company with two colummns com_id and com_name in Database

    <ComboBox Height="23" HorizontalAlignment="Left" Margin="67,21,0,0" Name="CmbOrg" VerticalAlignment="Top" Width="129" ItemsSource="{Binding Com_Name}" DisplayMemberPath="Com_Name"/>

created a domaincontext also domain service ...... using RIA Services

//to load the Company

      DictionaryDomainContext orgdemo = new DictionaryDomainContext();
            LoadOperation<Company> dict = orgdemo.Load(orgdemo.GetCompaniesQuery());
            CmbOrg.ItemsSource = dict.Entities;


//the value code which is getting saved to Database
 dc.Org_Name = CmbOrg.SelectedValue.ToString();

Answers (3)