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

Load On Demand result ordering issue

11 Answers 120 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Lorraine Pritchard
Top achievements
Rank 1
Lorraine Pritchard asked on 30 Jul 2008, 04:50 PM
I've just updated a project from the old ASP.NET RadControls to the latest Prometheus version. I'm encountering a problem with results being returned to a combobox with Load On Demand enabled, which I was not seeing under the earlier version.

The problem occurs when a user types in part of a word, pauses, then types in the rest of the word. This results in OnItemsRequested being invoked twice. What I'm seeing is that sometimes the second invocation of the event completes first. This results in the combobox being updated twice, with the last update being for the first event. The upshot of this is that the combobox ends up displaying results for the partial word, not the full one.

For example, the user types in go, pauses, then adds the letters ld. Sometimes this would result in the combobox being filled with entries starting with gold, and sometimes just with go.

I'm comfortable with the reason for the arbitrary order of completion of the two events. That's due to some queries against a database running longer than others, and is something I have no control over.

What I'm not comfortable with is the combobox showing the "wrong" resuts when this happens. What I'd like to do is something along the lines of preventing the databind in OnItemsRequested if the text currently entered no longer matches what it was when the event was first fired. I can't see any way to do this however.

I've experimented with setting the ItemsRequestedTimeout which has helped, but not solved, the problem.

Can you suggest a solution? The only way I can see to solve this at the moment is to go back to using the non-Prometheus version of the control which did not have this problem.

11 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 31 Jul 2008, 02:43 PM
Hi Lorraine Pritchard,

I suggest you set the ShowDropDownOnTextboxClick property to false and let us known if this helps.

Also could you please try to reproduce the issue with our online example?

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lorraine Pritchard
Top achievements
Rank 1
answered on 31 Jul 2008, 05:46 PM
Hi Rosi

Thanks for getting back to me.

Setting ShowDropDownOnTextboxClick false doesn't help I'm afraid. I can't reproduce the problem with your demo as it is responding almost immediately. The problem I am seeing is when there is a delay whilst requesting appropriate data from a database. Particularly, where the delay is not constant.

The following code illustrates the problem:

<tel:RadComboBox id="cbo" runat="server" EnableItemCaching="false" ShowDropDownOnTextboxClick="false" OnItemsRequested="ItemsRequested" EnableLoadOnDemand="true"> </tel:RadComboBox>

protected void ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
      RadComboBox combo = o as RadComboBox;

      int delay = 10 - e.Text.Length*2;
      if (delay > 0)
      {
        Thread.Sleep(delay*1000);
      }

      for (int i = 0; i < 9; i++)
      {
        combo.Items.Add(new RadComboBoxItem(e.Text, i.ToString()));
      }
}

This code pauses for a few seconds then fills the combobox with the entered text.

To see the problem,  type q, wait a second, they type wert. The dropdown will fill with qwert, then a few seconds later will fill again with q. This shows that the response from an earlier OnItemsRequested call can overwrite the results for what is currently in the entry box.
0
Rosi
Telerik team
answered on 01 Aug 2008, 10:14 AM
Hello Lorraine ,

I understand what the problem is. However the ItemRequestTimeout property should help. I suggest you set it to 2000 (ItemRequestTimeout="2000") and let us known how this goes.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lorraine Pritchard
Top achievements
Rank 1
answered on 01 Aug 2008, 11:39 AM
Hi Rosi

Thanks for the suggestion, but as I mentioned earlier I've tried setting the ItemRequestTimeout. This helped but didn't solve the problem. The variability in the time taken to return data from the database is too large to cover by setting this parameter to any reasonable value. My users would be better server by me reverting to using the pre-Prometheus version of the control where setting such an delay was unnecessary.

Is there no way to prevent the dropdown being populated by "out of date" OnItemsRequested calls?
0
Rosi
Telerik team
answered on 05 Aug 2008, 03:36 PM
Hello Lorraine ,

Please find our latest build and let us known how this goes. This should solve the problem.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lorraine Pritchard
Top achievements
Rank 1
answered on 06 Aug 2008, 04:23 PM
Hi Rosi

It has indeed fixed the problem. Many thanks for your help and for the fix. Will this be available in a non-trial version in the near future?
0
Rosi
Telerik team
answered on 07 Aug 2008, 07:35 AM
Hello Lorraine,

Yes, this fix will be included in the our official release of Q2 2008 SP1 during the end of this month.

However you can open a support ticket and I will send you the dev version of the build from the previous message.

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lorraine Pritchard
Top achievements
Rank 1
answered on 13 Aug 2008, 08:46 AM
Thanks Rosi

I've been doing some more testing on the trial hotfix and I think I've found a bug in it. If you type in a search term on a combobox with LoadOnDemand enabled, and the search term includes a space, the control continuously fires the OnItemsRequested event. Some encoding appears to be done on the search term each time.

For example, type in John Smith.
Event fires. Text property of RadComboBoxItemsRequestedEventArgs shows John Smith.
Event fires again. Text property shows John%20Smith.
Event fires again. Text property shows John%2520Smith.
And again. Text property shows John%252020Smith
And so on forever.
0
Helen
Telerik team
answered on 15 Aug 2008, 12:41 PM
Hi Lorraine,

We tested the latest hotfix locally, but couldn't reproduce the problem.

Please find attached a movie as part of our local tests.

What might be the difference in your case? Are we missing something?

Regards,
Helen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lorraine Pritchard
Top achievements
Rank 1
answered on 15 Aug 2008, 03:46 PM
Hi Helen

I don't see that we're particularly doing anything differently. I've been able to reproduce it just by adding the following to a new web form - 

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true" AsyncPostBackTimeout ="3600">
</asp:ScriptManager>
               
<tel:RadComboBox id="cbo" runat="server" EnableItemCaching="false"
           ShowDropDownOnTextboxClick="false" OnItemsRequested="ItemsRequested" EnableLoadOnDemand="true">                                                    
</tel:RadComboBox>

and the following to the codebehind - 

protected void ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
 {
      RadComboBox combo = o as RadComboBox;

      for (int i = 0; i < 9; i++)
      {
        combo.Items.Add(new RadComboBoxItem(e.Text, i.ToString()));
      }
 }

There is nothing else on the page. This is using the hotfix attached above. I can only assume that the problem has been fixed in the version that you tested with locally.

0
Helen
Telerik team
answered on 18 Aug 2008, 01:19 PM
Hello Lorraine,

Indeed it was an issue with the internal hotfix, which our developers immediately fixed and it didn't appear in the build I tested with.

Please find attached our the latest internal hotfix.

Hope it will help you solve the problem.

Regards,
Helen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Lorraine Pritchard
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Lorraine Pritchard
Top achievements
Rank 1
Helen
Telerik team
Share this question
or