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

"Telerik is not defined" when trying to create RadComboBoxItem in javascript

5 Answers 354 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 28 Feb 2013, 03:39 PM
I am trying to add elements to RadComboBox in "success" ajax request method.
However, I am getting "Telerik is not defined" error when I try to create the item.

How to achieve my goal?
$.ajax({
            type: 'POST',
            url: '../WebServices/GlobalEntityHelper.svc/GetEntityData',
            data: JSON.stringify({ request: JSON.stringify(dataToSend) }),
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function (result, status) {
                srcWindow.GlobalEntityRadCombobox.set_visible(result.d.Visible);
                if (srcWindow.GlobalEntityRadCombobox.get_visible()) {
                    var entityItems = srcWindow.GlobalEntityRadCombobox.get_items();
                    entityItems.clear();
                    srcWindow.GlobalEntityRadCombobox.trackChanges();
                    for (var i = 0; i < result.d.DataSource.length; i++)
                    {
                        var entityItem = new Telerik.Web.UI.RadComboBoxItem();
                        entityItem.set_text(result.d.DataSource[i].Key);
                        entityItem.set_value(result.d.DataSource[i].Value);
                        entityItems.add(entityItem);
                    }
                    srcWindow.GlobalEntityRadCombobox.commitChanges();
                    ddlHilightOption(srcWindow.GlobalEntityRadCombobox, '', result.d.EntityValue);
                    jQuery.data(srcWindow.GlobalEntityRadCombobox, 'filter-datamember', result.d.EntityFilterDataMember);
                    srcWindow.GlobalEntityRadCombobox.prop('entityTypeConst', result.d.EntityTypeConst);
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
            }

I have tried a lot of stuff, but no luck and I am out of ideas now :(

This happens in MASTER PAGE. On usual pages everything is ok.
And yes, I have read this: http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting.html
And I do not have outputcache directive and I do have webresource reference in my web.config

5 Answers, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 01 Mar 2013, 03:19 PM
I have fixed the error by adding scripts to radscriptmanager:
<asp:RadScriptManager ID="rsmDefault" OnAsyncPostBackError="rsmDefault_AsyncPostBackError"
    EnableScriptGlobalization="true" LoadScriptsBeforeUI="true" EnablePartialRendering="true"
    runat="server">
    <Scripts>
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryPlugins.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Navigation.NavigationScripts.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.ComboBox.RadComboBoxScripts.js" />
        <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.TouchScrollExtender.js" />
    </Scripts>
</asp:RadScriptManager>
new Telerik.Web.UI.RadComboBoxItem is not undefined anymore.
But how to fill RadComboBox with ItemTemplate on client-side? We are using 2011 version now and do not have client-side template support here yet!

0
Boyan Dimitrov
Telerik team
answered on 04 Mar 2013, 03:20 PM
Hello,

Thank you for contacting Telerik Support.

Your observations are absolutely correct and our RadComboBox client-side template support is included in  Q2 2012. 
I would suggest updating your RadControls to the newest official version. It will give you the ability to take advantage of all client-side templates features and functionalities that they offer. 
Please review our RadComboBox client-side templates help article and online demo that demonstrates their capabilities.

Hope that this will be helpful.

Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jesper Matthiesen
Top achievements
Rank 1
answered on 04 Mar 2013, 06:54 PM
Sorry, but we cannot upgrade for free anymore, it's expired. We gonna keep using version 2011 for now.

So the question is just

how to add elements to the OLD-FASHIONED :) combobox with itemtemplate (to be more precise - it contains checkboxes), using javascript? I am sure it's possible to do, maybe it's just quite verbose... Please, assist.
0
Alexander
Top achievements
Rank 1
answered on 05 Mar 2013, 09:44 AM
All in all, we will write own control to handle it easily.
0
Boyan Dimitrov
Telerik team
answered on 05 Mar 2013, 05:29 PM
Hello,

I am afraid that RadComboBox client-side templates are not supported scenario with RadControls 2011 version. Since it was a very requested feature, we have included it in RadControls Q2 2012 version. Here you may find all available client-side functionalities that come out of the box with our RadComboBox control. 

Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Jesper Matthiesen
Top achievements
Rank 1
Share this question
or