Load On Demand DropDownList (& DropDownListElement)

Thread is closed for posting
6 posts, 0 answers
  1. E9BD1CFF-DA4F-428E-82E4-2F5719DF410E
    E9BD1CFF-DA4F-428E-82E4-2F5719DF410E avatar
    36 posts
    Member since:
    Apr 2012

    Posted 12 Feb 2013 Link to this post

    Requirements

    RadControls version 2012.2.726.40
    .NET version 3.5
    Visual Studio version 2010 & 2012
    programming language VB.Net & C#

    PROJECT DESCRIPTION
    This project demonstrates "load on demand" functionality for a dropdownlist and the dropdownlistelement in a grid. Though using a dropdownlist to select from a large list of data is arguably not the best solution, the autocomplete mode of the dropdownlist is a very user friendly way to let your user choose from a large list of possible choices. However, binding large amount of data to controls does not improve the performance. Load on demand can help but is only available with the controls for ASP.NET and currently not supported by the WinForms RadDropDownList.

    The solutions contains 2 identical projects, one in VB.Net and one in C#. It is a single RadForm containing a RadDropDownList control and a RadGridView. All controls keep the designer defaults when placed on the form. Sample data is provided by the ExampleData class, which is able to generate a list of ExampleData objects to populate the dropdownlist. RadLabels are used to show the real time values of the RadDropDownList selected value.
    Only when the user selects an item from the dropdownlist, or when the (text-)input exactly matches the displaymember of a listed item, the selected index of the dropdownlist is set.

    When the application loads, RadDropDownList1 is initialized to act as a load on demand control. This is done in code behind to show which properties and events are used, but could also be done using the visual studio designer. Same applies to the settings of RadGridView1, more specifically the  GridViewComboBoxColumn.
    The RadDropDownList starts loading content when the user enters at least two characters (see KeyUp event). The gridviewcombobox refreshes after each keypress. Load on demand functionality for the gridviewcombobox is provided by changing the default editor to a "load on demand editor" using the RadGridView1_EditorRequired event.

    Though in the example project a object list serves as the dropdownlist datasource, it should work with other data sources as well.
    I hope you find this project helpful. I'm open to suggestions and improvements from the Telerik community.

    To test it, simply add "ab", "de" or any other string from the list in the ExampleData class and the control will be populated accordingly.

  2. F11ADD2A-840D-4563-BD9F-564CF2DD488A
    F11ADD2A-840D-4563-BD9F-564CF2DD488A avatar
    2911 posts
    Member since:
    Apr 2022

    Posted 15 Feb 2013 Link to this post

    Hi Raoul,

    Thank you very much for sharing your code with the community. I can say that this is an example of a CodeLibrary article - nice feature implemented, covered with detailed documentation and in both C# and VB.NET. Additionally, perfect explanation is provided as well.

    I am sure that this will be useful to many users.

    I have added 3000
    Telerik Points to your account for your time and efforts.

    Greetings,
    Stefan
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  3. 873F4BF6-2475-4302-AF07-1DF98D14DE2C
    873F4BF6-2475-4302-AF07-1DF98D14DE2C avatar
    4 posts
    Member since:
    Apr 2007

    Posted 11 Jun 2015 in reply to F11ADD2A-840D-4563-BD9F-564CF2DD488A Link to this post

    This is a great example.   

    1) How do you get the project to work when the user attempts to modify an existing dropdown field in the Grid?  I have attached a video of the issue when I attempt to modify the existing value. 

    2) Is it possible to filter where it beginswith (just as it does in the example) but also to only return the top nth (i.e. 100) values?

     

  4. C9F3D0E2-E9A1-4184-9D42-DF6715D046E4
    C9F3D0E2-E9A1-4184-9D42-DF6715D046E4 avatar
    2984 posts
    Member since:
    Nov 2022

    Posted 12 Jun 2015 Link to this post

    Hello Kenneth,

    Thank you for writing.

    1. In this case the cell value is set to a string (like "abc4560") and the second time when it is not modified it is retrieved from the grid directly not from the editor and in this case it cannot be parsed to a Guid. This can be solved by overriding the IsModified property in the custom editor class:
    Public Overrides ReadOnly Property IsModified As Boolean
        Get
            Return True
        End Get
    End Property

    2. Yes it is, you can take any number of results you want. This can be achieved when the data source is assigned:
    ddl.DataSource = _dropDownDataSource.Where(Function(c) c.ExampleDisplayMember.StartsWith(txt)).Take(2)
     
    In addition I want to mention that we have another example for this: Server side auto complete for RadDropDownList.

    I hope this helps.

    Regards,
    Dimitar
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  5. 24FC6E15-1D9C-4BFD-A9AA-D44A5D50AFA6
    24FC6E15-1D9C-4BFD-A9AA-D44A5D50AFA6 avatar
    3 posts
    Member since:
    Jan 2019

    Posted 04 Jan 2019 Link to this post

    I have a DropDownList for inputting the correct CVS fields for each field (see image). I need on page_load to auto populate these fields from an array of choices I have: 

    <option value="Address1">Address1</option>
    <option value="Address2">Address2</option>
    <option value="Address3">Address3</option>
    <option value="bounceCount">bounceCount</option>
    <option value="CompanyName">CompanyName</option>
    <option value="ContactPassword">ContactPassword</option>
    <option value="ContactSource">ContactSource</option>
    <option value="Country">Country</option>
    <option value="crmCompanyId">crmCompanyId</option>
    <option value="crmExtendedDetail">crmExtendedDetail</option>
    <option value="CSVCampaigns">CSVCampaigns</option>
    <option value="CSVImport">CSVImport</option>
    <option value="Department">Department</option>
    <option value="EMailLogin">EMailLogin</option>
    <option value="Fax">Fax</option>
    <option value="FirstName">FirstName</option>
    <option value="Industry">Industry</option>
    <option value="LastName">LastName</option>
    <option value="Mobile">Mobile</option>
    <option value="NumberOfEmployees">NumberOfEmployees</option>
    <option value="OptIn">OptIn</option>
    <option value="Phone">Phone</option>
    <option value="PositionInCompany">PositionInCompany</option>
    <option value="Postcode">Postcode</option>
    <option value="Region">Region</option>
    <option value="Title">Title</option>

    Will Load On Demand do what i need to? 

     

     

     

     

     

  6. 24FC6E15-1D9C-4BFD-A9AA-D44A5D50AFA6
    24FC6E15-1D9C-4BFD-A9AA-D44A5D50AFA6 avatar
    3 posts
    Member since:
    Jan 2019

    Posted 04 Jan 2019 Link to this post

    Image of my dropdownlist
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.