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

Load on Demand Radgrid in Combobox

1 Answer 83 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 17 Mar 2011, 04:32 PM
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

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 21 Mar 2011, 05:16 PM
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
Tags
ComboBox
Asked by
Paul
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or