Load on Demand Radgrid in Combobox

2 posts, 0 answers
  1. Paul
    Paul avatar
    5 posts
    Member since:
    Oct 2010

    Posted 17 Mar 2011 Link to this post

    hi telerik team

    I followed this demo http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridincombobox/defaultcs.aspx?product=combobox
    the difference is that i have two combos in cascade, so the first one has the radgrid load on demand, all is working, but i getting into a javascript error (see the image)

    this is my javascript code when select a row of the radgrid, i test it and see that the problem is the doPostback, so whats the correct way to make the cascading of the combos.

     function RowSelected(sender, args) {
                    var selectedText = args.getDataKeyValue("Name");
                    var selectedValue = args.getDataKeyValue("InstanceID");

                    var combo = $find('<%= rcCustomer.ClientID %>');

                    if (selectedValue.length > 0) {
                        combo.trackChanges();
                        combo.set_text(selectedText);
                        combo.set_value(selectedValue);
                        combo.get_items().getItem(0).set_text(selectedText);
                        combo.get_items().getItem(0).set_value(selectedValue);
                        combo.commitChanges();
                    }
                    __doPostBack(combo.id, "TextChange");
                }

    Thanks for the help
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 21 Mar 2011 Link to this post

    Hi Paul,

    In order to make cascading ComboBoxes, you should initiate an ajax request in order to add items to the second ComboBox. This should be implemented using the ajaxRequest method of the RadAjaxManager's client-side object. As an argument you should pass the value based on which items will be loaded. Also you should add specific ajax settings as shown below:
    <telerik:RadAjaxManager ID="RadAjaxManger1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManger1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ID of the seconnd ComboBox" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    I hope this would help.


    All the best,
    Dimitar Terziev
    the Telerik team
Back to Top