combobox selected value in database

I have a combobox in an application which is in wpf and linq
 <ComboBox Height="23" HorizontalAlignment="Left" Margin="70,32.24,0,0" Name="cbGroup" VerticalAlignment="Top" Width="187" AllowDrop="True" SelectedIndex="0">
                            <ComboBoxItem>Adult</ComboBoxItem>
                            <ComboBoxItem>Youth</ComboBoxItem>
                            <ComboBoxItem>Children</ComboBoxItem>
                            <ComboBoxItem>Unknown</ComboBoxItem>
                        </ComboBox>

I am using the following code to insert the selected value in the database

 NewContact.AgeGroup = (string)this.cbGroup.SelectedValue.ToString();

but this  inserts in the database
System.Windows.Controls.ComboBoxItem: Children
please let me know how  i can insert the text value of the selected value in the database
shoopakAsked:
Who is Participating?
 
Mihai StancescuConnect With a Mentor Software Engineer Commented:
Try this
NewContact.AgeGroup = this.cbGroup.Text;



Hope this helps!

Regards,
Mishu
0
 
burakiewiczCommented:
try this
NewContact.AgeGroup = this.cbGroup.SelectedItem.Value.ToString();
0
 
shoopakAuthor Commented:
this doesn't work because

SelectedItem doesn't have a value property

This application is in wpf  and dot net 3.5


app.gif
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.