Load data in combo when it is clicked

4 posts, 0 answers
  1. Thierry
    Thierry avatar
    5 posts
    Member since:
    Aug 2013

    Posted 23 Aug 2016 Link to this post

    I have combo added to every cell header of my grid to provide row filtering but I'm trying to load the data in the combo when it is clicked as per your sample:


    but no data is requested as per your sample. If I type something in the combo, it does trigger the ItemsRequested event, but I would like to load data when the combo is clicked. The reason I don't want to preloaded (as it is currently done!) is that if a user never uses any of the filters, he/she should not have to be penalized having to wait additional time for these to be filled, queries to get this data should not be executed, etc...

    This is the code I'm currently using:

    RadComboBox comboBox = new RadComboBox();
    comboBox.ID = GetFilterID(columnIndex);
    comboBox.MarkFirstMatch = true;
    comboBox.AutoPostBack = true;
    comboBox.CssClass = "Filter";
    comboBox.TextChanged += new EventHandler(comboBox_TextChanged);
    comboBox.ShowDropDownOnTextboxClick = true;
    comboBox.AppendDataBoundItems = true;
    comboBox.EnableLoadOnDemand = true;
    comboBox.DataTextField = filterableField.DataField;
    comboBox.DataValueField = filterableField.DataField;
    //comboBox.DataSource = GetFilterData(filterableField.DataField);
    comboBox.ItemsRequested +=new RadComboBoxItemsRequestedEventHandler(comboBox_ItemsRequested);
    comboBox.EnableVirtualScrolling = false;
    comboBox.ShowMoreResultsBox = false;
    comboBox.AllowCustomText = false;


    private void comboBox_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        Debug.WriteLine("");  //Load additional data from here.

    There is no html code as this is all done at run-time. Based on your sample as per link above, I can't spot any difference except that you have a RenderMode to "LightWeight" but I don't think that's the problem.

    Any ideas?


  2. Thierry
    Thierry avatar
    5 posts
    Member since:
    Aug 2013

    Posted 25 Aug 2016 in reply to Thierry Link to this post

    I'll add a bit of feedback but my issue is still not sorted.

    When trying to reproduce the problem in a new (empty) project, I noticed a couple of things:

    1. When defining the RadComboBox directly in my aspx page, it worked immediately.

    2. When creating the RadComboBox via code, it didn't work. My colleague then suggested that instead of adding the control to the page i.e. Page.Control.Add(combo), that I add it instead to a Panel. This solved the problem in test website but it still not displaying any of the requested data for some reason, even though the source is binded in the ItemsRequested and my code is identical as the one used in point 1. which displays everything correctly.

    I thought this could be the problem in my main app, but my RadComboBox is not added to the page directly. It is added to a TableCell which belongs to RadGrid but to be sure, I added the combo to a panel and then added the panel to my TableCell but it made no difference! It still doesn't trigger the ItemsRequested event.

    The Telerik version I'm using is: 2010.2.713.35, if that's of any use.

    Could it be a bug?


    it behaved exactly as my original question did i.e. ItemsRequested is not triggered when clicking on the drop down button.

  3. Thierry
    Thierry avatar
    5 posts
    Member since:
    Aug 2013

    Posted 25 Aug 2016 in reply to Thierry Link to this post

    I've given up trying to figure out why it's not working! Spent far too much time on it as it is!

    I've found a work-around and while I personally think it's ugly, it does work and it appears to be reliable. I'm now capturing on the client side when the drop down is expanded and when it is I'm calling the '.itemsRequested' via JavaScript. This seems to be reliable though I'm having a couple of minor issues where the number of items in my list always appears to be 1 when it should be 0 and my drop down is flickering a bit when my data is loaded but that could just be that I need to set a bigger height or something like similar.

    Anyway, here's the code I used my comboBox_PreRender:

    RadComboBox comboBox = (RadComboBox)sender;
    function ComboBoxDropDownOpening(sender, args)
    //alert('ComboBoxDropDownOpening - There are now ' + sender.get_items().get_count() + ' items.');
    if (sender.get_items().get_count() === 1)

    You may have to tweak it a bit, but hopefully this will help.


  4. Peter Milchev
    Peter Milchev avatar
    290 posts

    Posted 26 Aug 2016 Link to this post

    Hello Thierry,

    We recommend upgrading to the latest version of our controls. This way you could benefit not only from the bug fixes but the improved functionality and new features and controls.

    If updating to the latest version of the control does not solve the issue, would you please open an official support ticket with attached a sample runnable project that implements your approach and reproduces the problem?Thus, we would be able to investigate locally and help you in the most efficient way.

    Peter Milchev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top