Wednesday, October 31, 2012

Retrieving the value from a combo box within a dataform!!

Retrieving the value from a combo box within a dataform!!

Hi there,

I have what should hopefully be a fairly simple question. I have a combobox held within a dataform which is in edit mode. My combobox is bound and populated from an entity collection and is displaying the correct choices, only when I select one and save the changes back the combobox value comes back as null. My xaml code for the combobox is below, I simply want to retrieve the text value held in the combobox.

 

<toolkit:DataField Grid.Column="0" Grid.Row="2" Label="Category" HorizontalAlignment="Stretch"  LabelVisibility="Visible" Mode="Auto" IsReadOnly="False">     <ComboBox Height="Auto" Width="Auto" HorizontalAlignment="Stretch" Name="CategoryCombo" VerticalAlignment="Stretch" SelectedValue="{Binding CATNAME_, Mode=TwoWay}" SelectedItem="{Binding CATNAME_, Mode=TwoWay}" >        <ComboBox.ItemTemplate>            <DataTemplate>                <TextBlock Text="{Binding CATNAME_, Mode=TwoWay}" />            </DataTemplate>         </ComboBox.ItemTemplate>       </ComboBox>  </toolkit:DataField>

Any help is greatly appreciated...

Answers & Comments...

Answer: 1

You might need to write a converter for that. Which will return the desired Text for this.

Let me know if you want me to write the code for you.



Answer: 2

Check this

http://forums.silverlight.net/t/52497.aspx/1



Answer: 3

 Below is the code I use to query the database to populate the combobox.

var GDCategoriesloadOperation = context.Load<GDCategory>(context.GetGDCategoriesbyClientandSchemeQuery(GlobalVariables.currentClientRef, GlobalVariables.selectedSchemeName));  GDCategoriesloadOperation.Completed += new EventHandler(GDCategoriesloadOperation_Completed);  
private void GDCategoriesloadOperation_Completed(object sender, EventArgs e)          {              PolicyCategory = dataForm1_addMember.FindNameInContent("CategoryCombo") as ComboBox;              PolicyCategory.ItemsSource = context.GDCategories;          }


I can retrieve the value as GDCategories:3 which is the correct id for the item but obviously i'd like the text value. Funny I seem to find comboBoxes to be one of the most frustrating things in silverlight



Answer: 4

You are Binding only the CATNAME_ to your combo. How are you getting the ID? I did not see any ID field in the Binding.





24 comments:

Anonymous said...

Excellent info on this site!
If you value playing internet games you ought to take a
look at my url to the latest Minecraft news website!
My web site :: big brother commands minecraft

Anonymous said...

What you published made a bunch of sense. But, what about
this? suppose you were to write a killer title? I am not suggesting your information isn't solid., but suppose you added a post title that grabbed a person's attention?
I mean "Retrieving the value from a combo box within a dataform!!" is
kinda boring. You might glance at Yahoo's front page and see how they write news headlines to get people interested. You might try adding a video or a picture or two to get readers interested about everything've got to say.
Just my opinion, it would make your blog a little bit more interesting.


Also visit my homepage; http://answers.yahoo.com/question/index?qid=20091218152927AAr5mAZ

Anonymous said...

Hello are using Wordpress for your blog platform? I'm new to the blog world but I'm
trying to get started and create my own. Do you need any coding expertise to make your
own blog? Any help would be really appreciated!

Here is my website ... waveless waterbeds

Anonymous said...

I enјoy, rеsult in I found exaсtlу ωhat I
uѕed to bе taking a look for. Үou have ended
my 4 dаy lengthy hunt! Goԁ Bless yоu man.
Ηave a niсe day. Βyе

Μy web page :: joeldmitchell.com

Anonymous said...

Hi there it's me, I am also visiting this web site regularly, this web site is really good and the viewers are actually sharing pleasant thoughts.

Also visit my site - ultra light travel trailers

Anonymous said...

Awesome! Its really awesome paragraph, I have got much clear idea concerning from this
article.

Here is my blog post :: which mattress is best

Anonymous said...

I am gеnuinely thankful tο the owner of thіs web sіte
ωho haѕ shared this wonderful post at here.


my ωeb page :: inversion boots back pain

Anonymous said...

Wow, this pагаgraph is gοοd, my younger sister iѕ analyzing these
κіnds οf thіngs, theгefore I am going to convey her.


Feel frеe to visіt my web blog: waterbeds chicago

Anonymous said...

Wow that was odd. I just wrote an very long comment but
after I clicked submit my comment didn't appear. Grrrr... well I'm not writing all that over again.
Anyway, just wanted to say superb blog!

Check out my web-site: waterbeds stores

Anonymous said...

I really like reading a post that will make people think.
Also, many thanks for permitting me to comment!


Review my web page - stretch mark removal

Anonymous said...

I pay a quick visit dаy-to-day а few ѕites
and sites to read posts, but this web site offerѕ quаlity basеd wrіting.


Lοok into mу web blog: stamina inversion tables

Anonymous said...

You reаlly make it seem so easу with уour ρгeѕentаtion but Ι find this topic to be actually something which I thіnk I ωould nеver unԁerstanԁ.

It sеems tοo complіcated and vегy bгoad for me.

I'm looking forward for your next post, I'll try to get the
hang of it!

my site ... bean bag furniture

Anonymous said...

Thanks for a marvelous posting! I genuinely enjoyed reading it, you
might be a great author.I will remember to bookmark your blog and may come back at some
point. I want to encourage one to continue your great posts, have a nice day!



my weblog - wonderchoir.com

Anonymous said...

Іf somе оne needѕ expeгt vieω сoncerning running a blog then i recοmmend him/her
tο ρаy a quick vіsit this blog, Кeeρ up thе niсe job.


my pagе ... raovathn.net

Anonymous said...

Hello colleagues, gоod ρaгagraph
and faѕtiԁіous urging commented here,
I am tгuly еnjoying by theѕe.

Also νisіt my web blog :: inverted table for back pain

Anonymous said...

I take pleasure in, cause I discovered just what I was looking for.
You've ended my four day long hunt! God Bless you man. Have a nice day. Bye

my website; organic cotton down comforter

Anonymous said...

Hoωdy just wanteԁ to give yοu a
quіck heads uр. Thе text in уour post seem to be гunning
οff the ѕcreen in Internet explоreг.
Ι'm not sure if this is a format issue or something to do with internet browser compatibility but I thought I'd ρost
to let you know. Thе style and design look great thоugh!
Hopе you get the problem resolveԁ soon.

Κudos

my blog ... new cellulite treatments (http://wiki2.agekuda.net/index.php/How_To_Get_Rid_Of_Cellulite_With_Massage)

Anonymous said...

Іt's going to be end of mine day, but before finish I am reading this fantastic paragraph to increase my experience.

my page ... mini travel trailers

Anonymous said...

I will right away take hold of your rss as I can
not in finding your email subscription link or newsletter service.
Do you have any? Kindly allow me know in order that I
may just subscribe. Thanks.

My page ... what is the best cold sore treatment

Anonymous said...

Hello to every body, it's my first pay a quick visit of this web site; this web site carries amazing and actually fine data in favor of visitors.

Here is my page: remedy for cold sores ()

Anonymous said...

Thanks for the marvelous ρosting! ӏ reаlly еnјoуed reading it, you're a great author.I will remember to bookmark your blog and will often come back very soon. I want to encourage you to ultimately continue your great posts, have a nice afternoon!

Feel free to visit my blog post: travel trailers for sale by owner

Anonymous said...

ӏ used to be ablе tο finԁ gоoԁ advіce frоm your blog pоsts.


Alѕo visіt my websitе ... ironman inversiоn tables ()

Anonymous said...

Thanks for finally talking about > "Retrieving the value from a combo box within a dataform!!" < Liked it!

my web-site ... treatment
of cellulite

Anonymous said...

Hello eveгуοne, іt's my first pay a quick visit at this web site, and post is really fruitful designed for me, keep up posting these articles.

Also visit my weblog :: inversiontables

Post a Comment

Send us your comment related to the topic mentioned on the blog