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

Caching Data used with a Combobox

1 Answer 84 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 17 Sep 2017, 07:56 PM

I am using the following combobox to select cities from a view with 30000 rows.  

<telerik:RadComboBox ID="ddlCityO" TabIndex="1" runat="server" EmptyMessage="City, State" EnableItemCaching="True" DataSourceID="SqlDataSource1" MarkFirstMatch="True" EnableAutomaticLoadOnDemand="True" MinFilterLength="1" DataTextField="CityState" DataValueField="ID" DropDownAutoWidth="Enabled" Filter="Contains" Skin="MetroTouch" Placeholder="Destination" Width="300px"/>

Is there a better way to approach this?

I have tried to push the data into a datatable:

            db.Open()

            cmd = New SqlCommand("SELECT ID, CityState FROM v_City", db)
            cmd.CommandType = CommandType.Text



            Dim da As SqlDataAdapter = New SqlDataAdapter()
            da.SelectCommand = cmd


            Dim ds As New DataTable
            da.Fill(ds)
            db.Close()

            ddlCityO.DataSourceID = "datatable"
            ddlCityO.DataSource = ds
            ddlCityO.DataTextField = "CityState"
            ddlCityO.DataValueField = "ID"
            ddlCityO.DataBind()

 

This returns an error of "There is no assigned datasource. Unable to complete the callback request"

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 20 Sep 2017, 03:58 PM
Hello Michael,

When setting the DataSource property, the DataSourceId should not be set. 

Also, when using the DataSource property with the AutomaticLoadOnDemand, the DataSource should be set on every postback as suggested in the Automatic Load On Demand article.

Please find attached a sample project implementing the suggested approach.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ComboBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or