This is a migrated thread and some comments may be shown as answers.

Load on Demand Grid in Combobox

3 Answers 113 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Justin Lee
Top achievements
Rank 1
Justin Lee asked on 19 Oct 2011, 08:30 PM
I have a RadCombobox being used exactly like the example here:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridincombobox/defaultcs.aspx?product=combobox

I pretty much copied the code from the demo.  Everything works exactly like the demo except for 1 thing...  If you type too fast, its stops working.  After entering 3 characters, it works fine if you wait for the grid to load after each character, but if you type too fast, it stops working.  Once it stops working, the grid doesn't refresh even if you clear the text and start again. You have to refresh the page to get it to start working again.

I cannot reproduce it in the online demo, and since my code is the same, I don't expect you to know what's wrong.  However, if you can give me some tips on what might be the cause, or a way to diagnose the issue, it would be greatly appreciated.

Differences between my app and the demo:
    - I'm calling a WCF server from the code behind instead of retrieving directly from a database
    - My combobox is in the masterpage of the site.
    - My application is in SharePoint

Thanks,
Justin

3 Answers, 1 is accepted

Sort by
0
Justin Lee
Top achievements
Rank 1
answered on 20 Oct 2011, 04:13 PM
Update:  I've wrapped all related code in the code behind in a try/catch, and in the catch, I set the grid's datasource to an empty collection.  When the issue occurs, the grid not cleared, so an error is not getting thrown in the code.

I've also wrapped all javascript in try/catches, and call alert("error!") in the catch - but an alert does not appear, so no error is thrown in the javascript.

I also tried increasing the RequestQueueSize of the RadAjaxManager, but it did not help.

I double checked my code, and it is identical to the demo's code.

I also noticed that after typing the 3rd character, the loading panel does not display. (but it for characters after that).  Once its broke (from typing too fast), the loading icon never displays, and the grid never refreshes.  --I don't really care if the loading icon doesn't display after the 3rd character, but I thought the behavior might help diagnose the issue.

Thanks,
Justin


0
Justin Lee
Top achievements
Rank 1
answered on 20 Oct 2011, 06:16 PM
More info:

1. To rule out the WCF call causing the problem, I change the NeedDataSource method of the grid to just wait for 4 seconds, and then bind the grid to a list of one item (with one property set to the combobox's text)
protected void grdSearch_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
   RadGrid grid = source as RadGrid;
   try
   {
      System.Threading.Thread.Sleep(4000);
       grid.DataSource = new List<SearchResult>() { new SearchResult() { ItemID = "123", Name = cmbSearch.Text, TypeOfItem = "Debug" } };
   }
   catch (Exception ex)
   {
      grid.DataSource = new List<SearchResult>() { new SearchResult() { ItemID = "123", Name = ex.Message, TypeOfItem = "Error" } };
   }

The issue still occurs.

2.  I added a line to the javascript to display a message (alert) right after the ajax call:
    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("LoadFilteredData");
    alert('request sent');
    return true;

   The "request sent" message displays always - AND the issue goes away.  I can add characters while the grid is loading and it continues to work, but obviously I cannot leave the alert in there.  It's almost like the RadAjaxManager can't perform more than 1 request per X milliseconds.  Clicking on the alert window gives it just enough time between requests (even though the grid is still reloading)

3.  Another issue I'm having that may be related...  If I enter an ampersand (&) in the combobox, it will break in the same fashion as if I enter characters to fast.

When running Fiddler, it shows no requests sent out while its 'broke'.

I'm using Q2 2011. 

Please help if you can.

Thanks,
Justin

0
Justin Lee
Top achievements
Rank 1
answered on 21 Oct 2011, 02:16 PM
I ended up changing my implementation of this because I couldn't get it to work, so this thread can be ignored.
Tags
ComboBox
Asked by
Justin Lee
Top achievements
Rank 1
Answers by
Justin Lee
Top achievements
Rank 1
Share this question
or