Caching Data used with a Combobox

2 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Apr 2016

    Posted 17 Sep Link to this post

    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?

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    282 posts

    Posted 20 Sep Link to this post

    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.
Back to Top