[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

combobox selected value in database

Posted on 2008-06-26
5
Medium Priority
?
2,929 Views
Last Modified: 2013-11-07
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
0
Comment
Question by:shoopak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Expert Comment

by:burakiewicz
ID: 21875905
try this
NewContact.AgeGroup = this.cbGroup.SelectedItem.Value.ToString();
0
 

Author Comment

by:shoopak
ID: 21877817
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
 
LVL 11

Accepted Solution

by:
Mihai Stancescu earned 200 total points
ID: 21907998
Try this
NewContact.AgeGroup = this.cbGroup.Text;



Hope this helps!

Regards,
Mishu
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question