Load On demand on radcombobox with itemtemplate (with filter contains)

1 Answer 137 Views
ComboBox
Vincent
Top achievements
Rank 1
Iron
Iron
Vincent asked on 15 Mar 2023, 04:23 PM

Hi !

How to use the EnableLoadOnDemand on radcombobox with item template ?

because i've got many Data (over 3000), change with agencyID and for not reload and make object, set on viewstate.

How to user this with filter contains ? because itemsRequested add only radcomboboxitem to radcomboboxitems.

 EnableLoadOnDemand="true" ItemsPerRequest="100" EnableVirtualScrolling="true"

Actually, my sample (Aspx) :

<telerik:RadComboBox RenderMode="Lightweight" Skin="Material" ID="rcbNomEntreprise" runat="server" EmptyMessage="Entreprise / Siren" CssClass="rcb" AutoPostBack="true" Filter="Contains" Width="100%" MaxHeight="400px" Culture="fr-FR" DropDownCssClass="rcbSP2 rcbFiltreContent FiltreNavOperation">
	<ItemTemplate>
		<div class="rcbEntreprise">
			<div class="entreprise-nom gcs">
				<%# Eval("NomEntreprise") %>
            </div>
            <div class="entreprise-siren gcs" >
				Siren : <%# Eval("Siren") %>
            </div>
            <address>
				<%# Eval("Adresse") %>
            </address>
            <div class="cpCommune"> <%# Eval("CPetCommune") %></div>
            <%# If(DirectCast(Eval("IsAutoriseCompta"), Boolean) = True, String.Empty, "<div class=""gcs bloqueCompta"">cette entreprise n'est pas autorisée pour les nouveaux marchés.</div>") %> 
        </div>
    </ItemTemplate>
</telerik:RadComboBox>

Vb for binding :


    Private Property EntreprisesAgence As List(Of RechercheEntreprise)
        Get
            Return ViewState("entreprisesAgence")
        End Get
        Set(value As List(Of RechercheEntreprise))
            ViewState("entreprisesAgence") = value
        End Set
    End Property

In Load :

If EntreprisesAgence Is Nothing Then InitEntreprise() ' Get SQL data to Object, to Viewstate

            With rcbNomEntreprise
                .DataSource = EntreprisesAgence
                .DataTextField = "Complet"
                .DataValueField = "identreprise"
                .DataBind()
            End With
Thanks.

 

 

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 20 Mar 2023, 02:49 PM

Hello Vincent,

 

To enable LoadOnDemand, you will basically need to bind data in the ItemsRequested event. Also, in the ItemsRequested event, you will have information about the Context such as (text, that you type when searching/filtering, the value after selecting an item, NumberOfItems to be fetched, etc).

You can use that information to filter the data source before returning it to the client. 

 

If you want to pass custom data to the server, you can do so by following the instructions from the Passing Context Information to the Server article.

 

Regards,
Attila Antal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ComboBox
Asked by
Vincent
Top achievements
Rank 1
Iron
Iron
Answers by
Attila Antal
Telerik team
Share this question
or