views:

19

answers:

0

The user control contains Related ComboBoxes as in the provided example at http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx which works well when added to a page.

When I add the user control as Edit Form in a RadGrid as shown in the example http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx the ComboBoxes do not get their event handlers correctly registered.

I am hoping that someone has seen this before and knows the answer. I am working up a self contained example that I will append as needed.

Edit: Solution found. It keys around using RadComboBox1_ItemsRequested to handle the fill:

    <telerik:RadComboBox ID="RadComboBox1" runat="server" AllowCustomText="True"
        AutoPostBack="True" EnableLoadOnDemand="True" 
        OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged" 
        OnItemsRequested="RadComboBox1_ItemsRequested" ItemRequestTimeout="500" 
        MarkFirstMatch="True">
    </telerik:RadComboBox>


    protected void RadComboBox1_ItemsRequested(object o, 
                                RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboBox combo = (RadComboBox)o;
        combo.Items.Clear();
        LinerModelDataContext dataContext = new LinerModelDataContext();
        var products = (from p in dataContext.Products
                        where
                            p.CategoryID == CategoryID
                            &&
                            p.Product1!=null
                        select p.Product1).Distinct();
        if (products.Count() > 0)
        {
            combo.DataSource = products;
            combo.DataBind();
        }
    }