Telerik ASP.NET RadDropdownList 'top 25' code example

Some drop down lists are just a few items, but some might have potentially thousands of items, and that... too much for a mobile ASP.NET application. 

The code below will retrieve the 'top 25' items

Front side code

<telerik:RadComboBox Width="300px" ID="cboCustomer" RenderMode="Lightweight" AllowCustomText="true"
    DataTextField="custname"
    DataValueField="custnmbr"
    EnableAutomaticLoadOnDemand="true"
    ItemsPerRequest="50"
    runat="server"></telerik:RadComboBox>

Code behind

Private Sub cboCustomer_ItemsRequested(sender As Object, e As RadComboBoxItemsRequestedEventArgs) Handles cboCustomer.ItemsRequested
        Dim strError As String = ""
 
        Try
            cboCustomer.DataSource = SPs.FP_RM00101_SEL_CUSTNAME(e.Text, App.ConnectionString).getTable
            cboCustomer.DataBind()
        Catch ex As ThreadAbortException
        Catch ex As Exception
            ErrorHandler.globalErrorHandler(ex, strError, "Express", app.TabletUserName, False)
            Me.lblError.Text = ex.Message
        End Try
 
    End Sub
 
    Private Sub ChooseCustomer_Init(sender As Object, e As EventArgs) Handles Me.Init
        cboCustomer.DataSource = SPs.FP_RM00101_SEL_CUSTNAME("zzz", Session("ConnectionString")).getTable
        cboCustomer.DataBind()
    End Sub

 

 

 

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences