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

SelectedValue and LoadOnDemand

3 Answers 144 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brady
Top achievements
Rank 1
Brady asked on 22 Apr 2009, 11:27 AM
I'm using Telerik RadComboboxes in an ASP.NET application, but find myself at a dilemma with using load-on-demand.  When I load the page for an exiting item, my current code depends on the value for certain fields to already exist in the combo, e.g. when I assign a site ID to the SelectedValue of a combo during page load, the callback for loading items fails, somehow because the value doesn't already exist in the combo.

Is there a proper way to handle load on demand for existing items that already have values for combos, when the combos aren't loaded yet, or do I simply have to code my whole form twice, once for inserting new items, and once for editing existing items?

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 24 Apr 2009, 02:37 PM
Hello Brady,

I suppose that the combobox is in EditItemTemplate of RadGrid or FormView.

In this case you can set the SelectedValue property of the combo like below:

SelectedValue='<%# Bind("ID") %>'

Let us know if this helps.

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Brady
Top achievements
Rank 1
answered on 24 Apr 2009, 02:43 PM
Veselin, this doesn't help, as I get an error that the ID field doesn't exist in the data source for the combo.  Remember we are dealing with two data sources here:  The first provides the list of items in the combo, and the second provides the selected value.

By the way, the combo is on a User Control, used in Pop-up edit mode of the grid, not in a template.
0
Veselin Vasilev
Telerik team
answered on 27 Apr 2009, 07:59 AM
Hi Brady,

The ID was only a sample, you need to put here the name of the column holding the value of the combobox.

If it does not help - please open a new support ticket and attach a sample project there. We will inspect the code and provide you a solution.

All the best,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Brady
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Brady
Top achievements
Rank 1
Share this question
or