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

ItemsRequested event not firing

1 Answer 180 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 2
Rick asked on 09 Feb 2009, 08:05 PM

I have inherited from the previous developer, a large project that uses the Rad Classic .Net Controls.

I have installed the new Ajax .Net controls and I am trying to restore all functionality to the site.

I have changed the code that uses RadComboBox to use the new properties according to the documentation on doing this.

The code now compiles cleanly, but the ItemsRequested event is not firing, so the RadComboBox does not populate. Other events, such as Load and Init, do fire, just not ItemsRequsted.

I tried a simple example in a separate project and the RadComboBox works as expected. However, if I cut and paste the control from that project into my project, the event does not fire on it either.

I would consider using the web service interface instead, but I am having trouble getting that to work as well and that is a different story. For now, I would rather just use the existing code if I can get it to work and I am baffled why the event will not fire.

The code is below. The Load and Init events fire as expected. But when I type in the combobox, the ItemsRequested event does not.

This User Control (ASCX) is used by an ASPX file, which uses a master page, which puts a script manager onto the page... in case any of that matters.

In ASCX file:  
 
<rad:RadComboBox ID="RadComboBox2"   
  EnableLoadOnDemand="true" 
  Skin="Vista" 
  Width="250px" 
  runat="server"   
  OnItemsRequested="RadComboBox2_ItemsRequested"   
  oninit="RadComboBox2_Init"   
  onload="RadComboBox2_Load">              
</rad:RadComboBox>   
 
In CodeBehind:  
 
    protected void RadComboBox2_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)  
    {  
        // Never gets here.
        for (int i = 1; i < 10; i++)  
        {  
            RadComboBoxItem item = new RadComboBoxItem();  
            item.Text = "Item " + i.ToString() + " added from ItemsRequested event";  
            RadComboBox2.Items.Add(item);  
        }  
    }  
 
    protected void RadComboBox2_Load(object sender, EventArgs e)  
    {  
         // This event fires.
    }  
 
    protected void RadComboBox2_Init(object sender, EventArgs e)  
    {  
         // This event fires.
    }  
 

Any idea why the event won't fire?

Rick.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Feb 2009, 08:59 AM
Hello Rick,

Your code looks ok and provided that it works in a different project we cannot tell why it doesn't in this one. Are there any javascript errors appearing in your page when you type in the combobox? I suggest you open a support ticket and send us a runnable version of your project which demonstrates the issue. Thanks.

All the best,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Rick
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Share this question
or