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

[Solved] Using Telerik RadComboBox within a repeater

2 Answers 290 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael Liedtke
Top achievements
Rank 1
Michael Liedtke asked on 05 Feb 2010, 08:34 PM

I have a repeater that contains a Telerik RadComboBox:

<asp:Repeater ID="rpt" runat="server">
   
<ItemTemplate>
       
<telerik:RadComboBox ID="rcb" runat="server" EnableLoadOnDemand="true"  
             
AllowCustomText="true" ItemRequestTimeout="1000"
             
NumberOfItems="10" MarkFirstMatch="false">
       
</telerik:RadComboBox>
   
</ItemTemplate>
</asp:Repeater>

In the ItemDataBound event of the Repeater, I am wiring up the ItemsRequested event like this:

private void rpt_ItemDataBound(object sender, RepeaterItemEventArgs e) {
   
RadComboBox rcb = (RadComboBox)e.Item.FindControl("rcb");
    rcb
.ItemsRequested += rcb_ItemsRequested;
}
private void rcb_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) {
   
// Database call to load items occurs here.
   
// As configured, this method is never called.
}

Currently, the server-side rcb_ItemsRequested method is never called. I suspect that wiring the ItemsRequested event in the ItemDataBound is problematic, but the problem may lie elsewhere.

Any ideas on how to use the Telerik RadComboBox within a repeater properly? I also tried wiring the event in the markup, but that did not help either. I am using the latest version of the ASP.NET AJAX Rad Controls.

----------

I posted this question at stackoverflow:

http://stackoverflow.com/questions/2209503/using-telerik-radcombobox-within-a-repeater

2 Answers, 1 is accepted

Sort by
0
Michael Liedtke
Top achievements
Rank 1
answered on 05 Feb 2010, 08:53 PM
I was being myopic and used ItemsRequested="rcb_ItemsRequested" instead of the correct OnItemsRequested="rcb_ItemsRequested" in the markup. This has corrected the issue, though it is not clear to me why the events could not be wired in the ItemDataBound method. Perhaps that has to do with when the event lifecycle.
0
Lenny_shp
Top achievements
Rank 2
answered on 08 Feb 2010, 02:36 PM
Can you post your final ItemTemplate and code behind?   Also code to get the value of each combobox value in the repeater?
Thanks.
Tags
ComboBox
Asked by
Michael Liedtke
Top achievements
Rank 1
Answers by
Michael Liedtke
Top achievements
Rank 1
Lenny_shp
Top achievements
Rank 2
Share this question
or