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

EnableAutomaticLoadOnDemand and SelectedValue for existing data

1 Answer 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 01 Apr 2011, 02:24 PM
I have a radComboBox in a usercontrol within a RadGrid.

The combo box contains a list of approx 3000 clients, so I have set EnableAutomaticLoadOnDemand = true so that when open the usercontrol, the load time of the form is quite fast.

This works well for adding new records, however when I am trying to edit a record which already has a client set, the SelectedValue property will fail to pick the value from the list (as I guess it hasn't been loaded yet).  As soon as I revert to the default of EnableAutomaticLoadOnDemand = false as shown in my code snippet below, then the SelectedValue property will correctly set the value from the list, but this then takes a couple of seconds to load the combo data.

Is there any way that I can set EnableAutomaticLoadOnDemand = true, while also getting the SelectedValue property to set the correct value from the data source?  (As an added complication, I also have a "Select from Template" combo box which will set various values in other text boxes and combo boxes, which I would also like to use with EnableAutomaticLoadOnDemand = true.)

Thanks for your help,
Ben


 

<tr>

 

 

<td>

 

Client

 

</td>

 

 

<td>

 

 

<telerik:RadComboBox ID="cboClient" Runat="server" AllowCustomText="true"

 

 

DataSourceID="SqlDataSource1" DataTextField="Account" DataValueField="ClientID"

 

 

Skin="Outlook"

 

 

 

SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ClientID") %>'

 

 

 

Width="320px" EnableVirtualScrolling="True"

 

 

 

Filter="Contains" ItemsPerRequest="20" ShowMoreResultsBox="True">

 

 

<itemtemplate>

 

 

<table style="width:300px">

 

 

<tr>

 

 

<td style="width:100px; text-align: left;">

 

<%

#DataBinder.Eval(Container.DataItem, "Account")%>

 

 

 

</td>

 

 

<td style="width:200px; text-align: left;">

 

<%

#DataBinder.Eval(Container.DataItem, "Disp")%>

 

 

 

</td>

 

 

</tr>

 

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 06 Apr 2011, 11:12 AM
Hi Ben,

The default value cannot be set for RadComboBox when EnableAutomaticLoadOnDemand is set to 'true'. This is because in this case there are no items in the RadComboBox and thus no item corresponding to the selected value can be found. However, you can try setting the RadComboBox Text property. In this case you might need to enable typing for the RadComboBox.

Best wishes,
Vasil
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
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or