This is a migrated thread and some comments may be shown as answers.

RadComboBoxItem Data Issue

2 Answers 83 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Wendy Hunt
Top achievements
Rank 2
Wendy Hunt asked on 01 Apr 2010, 04:09 PM
Sorry if this has been covered before...

I'm using VS2008 and the Entity Framework DataModel.

I have some fields in the database that are just strings saying "True" or "False".  There are about 15 or so entries for each field.  I can't do a databaind on the fields because I end up with 15 or so trues and falses in the drop down.  So I decided that I'd like to use the <Items><...RadComboBoxItem> instead to display the choices.  My problem is that I can't pull out the correct data from the database for the respective fields. 

Example:
I have one field called 'Half Year Interest' and the data is "False". 
My code behind is
this.halfYearInterestGroup9RadComboBox.Text=study.DataModel.Half_Year_Interest9;
My aspx code is
            <telerik:RadComboBox ID="halfYearInterestGroup9RadComboBox" runat="server" Width="200px" 
              style="left: 662px; top: 350px; position: absolute; text-align: right;">  
                <Items> 
                  <telerik:RadComboBoxItem Text="" Value="" /> 
                  <telerik:RadComboBoxItem Text="True" Value="True" /> 
                  <telerik:RadComboBoxItem Text="False" Value="False" /> 
                </Items> 
              </telerik:RadComboBox> 
It is pulling up the default empty string instead of "False". 

It feels like there is some connection piece missing somewhere, like the combobox isn't receiving data from the database somehow.  BUT... When I run the program and put breakpoints on the backend, I hover over the fields and see the correct data... I just then don't see it on the aspx side when it's completed running.

My question is this:  How can I pull up the correct data from the database and still use the Item Selections from the aspx page?

Any help would be greatly appreciated.
Thanks!
wen

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 02 Apr 2010, 10:06 AM
Hi Wendy Hunt,

Please use this code instead:

this.halfYearInterestGroup9RadComboBox.SelectedValue = study.DataModel.Half_Year_Interest9;

Hope this helps.

Best wishes,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Wendy Hunt
Top achievements
Rank 2
answered on 07 Apr 2010, 07:09 PM
It worked.  Thank you very much.

wen
Tags
ComboBox
Asked by
Wendy Hunt
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Wendy Hunt
Top achievements
Rank 2
Share this question
or