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

[Solved] ComboBox _ItemsRequested Problem

5 Answers 145 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
ratan mishra
Top achievements
Rank 1
ratan mishra asked on 14 Dec 2009, 03:01 PM
Hi All,

Here i had used RadComboBox  with _itemsrequested property and also total count of the items(i.e Items 1-5 out off 20) in the combobox at the bottom, Their is an issue regarding that (i.e on page load when i click on the combobox for the first time i am unable to get the total count of the combobox items but when i click on the area where i get that message then i will be getting the items message (i.e Items 1-5 out off 20) this message is been placed in the _itemsRequested so i am able to get the items message at the bottom of the combobox so how do i get the items count message on page load when i click on the combobox for first time.

Here is the code


protected void cmbPlatformName_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e){DataTable data = objTaskmanLib.GetData(e.Text); //GetData(e.Text); 
//objTaskmanLib is the library file from where i get the count.
  RadComboBoxItem item = new RadComboBoxItem();int itemOffset = e.NumberOfItems;int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);e.EndOfItems = endOffset == data.Rows.Count;for (int i = itemOffset; i < endOffset; i++){cmbPlatformName.Items.Add(new RadComboBoxItem(data.Rows[i]["Platform_Name"].ToString(), data.Rows[i]["Platform_Name"].ToString()));}e.Message = GetStatusMessage(endOffset, data.Rows.Count);}private string GetStatusMessage(int endOffset, int total){if (total <= 0)return "No matches";return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, total);}

Here i had used this GetStatusMessage function only in the _itemsRequested event so i am able to get the items message(i.e Items 1-5 out off 20) when i click on the area where items message is been displayed. so can any one help me how to use this function on page load also.

Thanks in advance.

5 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 16 Dec 2009, 10:37 AM
Hello ratan mishra,

The 'Show More Results' message appears with the first Items Request updates with each subsequent one. (Please see this demo.)

Can you please explain when exactly the 'Shore More Results' message does not appear?

Greetings,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ratan mishra
Top achievements
Rank 1
answered on 22 Dec 2009, 01:56 PM
Hi Simon,

Thanks for the reply i had struck with one problem.

In my combobox i am using items_requested event but on page load when i click the combobox for the first time i am unable to get the count of the items in the combobox but i am able to get the count of the items in the combobox only when i type any letter in the combobox and also duplicates are being added once (i.e if i have 5 items in the combobox when i click any letter in the combobox then extra 5 items are being added that is total 10 items are being shown in the combobox) but when i click any letter if i have any items related to that letter (i.e if typed letter have 1 item in the combobox it is showing duplicate items that is is 2 items but in the below message count it is showing 1 item)

Simon can u please help me out i was strucked at this point reply me soon.

Thanks in Advance.


0
Simon
Telerik team
answered on 23 Dec 2009, 01:16 PM
Hi ratan mishra,

Please call RadComboBox.Items.Clear() in Page_Load before binding the RadComboBox to resolve this issue. Additionally bind it only on the first page load:

RadComboBox.Items.Clear()
 
if (!Page.IsPostBack)
{
    Bind(RadComboBox);
}

Sincerely yours,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ratan mishra
Top achievements
Rank 1
answered on 24 Dec 2009, 07:22 AM
Hi Simon,

Thanks for the reply one issue has been solved (i.e when i click any word in the RadCombobox duplicates are not been added previously duplicates were added) thanks for that, but one issue has to be solved (i.e when i click RadCombobox Dropdown i am unable to get the total count in the RadCombobox at the bottom of it, but i am able to get the count only when i click any word in the RadCombobox) can u please send me how can i solve this issue when i click the Dropdown also i can get the total count of the RadCombobox.

Thanks in Advance.
Ratan Mishra.
0
Yana
Telerik team
answered on 28 Dec 2009, 03:30 PM
Hello Ratan,

Could you please paste some simple code so we to be able to test this issue locally? Thanks

Best regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
ratan mishra
Top achievements
Rank 1
Answers by
Simon
Telerik team
ratan mishra
Top achievements
Rank 1
Yana
Telerik team
Share this question
or