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

RadComboBox not firing itemsrequested after item selected

4 Answers 296 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Damian Chen
Top achievements
Rank 1
Damian Chen asked on 25 Jan 2010, 01:24 AM
I have my ItemsRequested handler working where on start of the page, this method gets hit and it loads the first set of items.  Scrolling through the list works well and each new page is requested and starts loading.

However, if I go into the combo box and right away I starting typing something which does not appear in the first page of results, the item is listed but I am no longer able to change the results and see the new matches appear in the list of the combo box.

The list is approx. 3,000 records, here are the relevant snips:

 

protected void RadComboBoxMedicationName_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

 

{

 

Database db = DatabaseFactory.CreateDatabase();

 

 

RadComboBox r = sender as RadComboBox;

 

 

DbCommand cmd = db.GetSqlStringCommand("SELECT Id, Description FROM refMedType WHERE Description LIKE '" + e.Context["Text"].ToString() + "%'");

 

 

DataTable data = (DataTable)(db.ExecuteDataSet(cmd)).Tables[0]; ;

 

 

try

 

{

 

int itemsPerRequest = 25;

 

 

int itemOffset = e.NumberOfItems;

 

 

int endOffset = itemOffset + itemsPerRequest;

 

 

if (endOffset > data.Rows.Count)

 

{

endOffset = data.Rows.Count;

}

 

if (endOffset == data.Rows.Count)

 

{

e.EndOfItems =

true;

 

}

 

else

 

{

e.EndOfItems =

false;

 

}

 

for (cint i = itemOffset; i < endOffset; i++)

 

{

r.Items.Add(

new RadComboBoxItem(data.Rows[i]["Description"].ToString(), data.Rows[i]["Description"].ToString()));

 

}

 

if (data.Rows.Count > 0)

 

{

e.Message =

String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());

 

}

 

else

 

{

e.Message =

"No matches";

 

}

}

 

catch (Exception ex)

 

{

e.Message =

"No matches";

 

}

}


 

 

<telerik:RadComboBox ID="RadComboBoxMedicationName" ShowWhileLoading="true" EmptyMessage="Enter medication name" Text='<%# Bind( "MedicationName" ) %>' LoadingMessage="Loading..." runat="server" Width="250px" Height="200px" AllowCustomText="True" ShowMoreResultsBox="true" EnableLoadOnDemand="True" MarkFirstMatch="True" OnItemsRequested="RadComboBoxMedicationName_ItemsRequested" EnableVirtualScrolling="true" />

 

 

 

 

 

<asp:RequiredFieldValidator ID="RequiredFieldValidatorMedicationName" runat="server" ControlToValidate="RadComboBoxMedicationName" Display="Dynamic" ErrorMessage="RequiredFieldValidator" ToolTip="Medication required."><br />* Medication required.</asp:RequiredFieldValidator>

 

 

 

4 Answers, 1 is accepted

Sort by
0
Damian Chen
Top achievements
Rank 1
answered on 25 Jan 2010, 05:26 AM
Found the issue - was a bug in the control as listed in the release notes.  Fixed in later versions, but for now you can use the script to set endofitems to false
0
nirav
Top achievements
Rank 1
answered on 11 Jan 2011, 02:53 PM
I would like to know from which version the issue has been resolved.
I am using version "2010.1.309.20" and facing the same issue. Although the issue occurs very rarely say 1 out of 20 attempt.

It occurs specially when I type complete text matching an item (regardless of existence of item on same page or next or any other page, however, I found that issue occurs bit frequently for items not on same page.) As I type the complete text in filterbox, that makes the text unique to match exactly with one and only one item from the combo list.

I tried to play with grid on the demo site and was able to reproduce the issue.
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandcombo/defaultcs.aspx?product=grid
0
Luis Barahona
Top achievements
Rank 1
answered on 20 Apr 2011, 09:41 PM
anyone?, I was using the version 2010.3.1304.20 in one of my projects, and suddenly the itemrequested on my radcomboboxes stopped working, I don't know why, and actually if I run the same project with the same Telerik dlls on the server then the radcombobox works fine. I'm not sure, if it is because I installed on my local machine the RadControls for ASP.NET AJAX Q1 2011, that's the only difference between my local machine and the server, and as I mentioned before those controls were working fine...
anyone?
0
Dimitar Terziev
Telerik team
answered on 26 Apr 2011, 03:02 PM
Hi Luis,

Since this problem seems to be related to your specific scenario and you have already opened a support ticket, we will continue the discussion there.

If the problem turns to be a general one, I'll share the solution here.

Best wishes,
Dimitar Terziev
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
ComboBox
Asked by
Damian Chen
Top achievements
Rank 1
Answers by
Damian Chen
Top achievements
Rank 1
nirav
Top achievements
Rank 1
Luis Barahona
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or