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

6 posts, 0 answers
  1. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 28 Feb 2013 Link to this post

    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
  2. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 01 Mar 2013 Link to this post

    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!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 04 Mar 2013 Link to this post

    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.
  5. Jesper Matthiesen
    Jesper Matthiesen avatar
    8 posts
    Member since:
    Oct 2008

    Posted 04 Mar 2013 Link to this post

    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.
  6. Alexander
    Alexander avatar
    152 posts
    Member since:
    Jun 2012

    Posted 05 Mar 2013 Link to this post

    All in all, we will write own control to handle it easily.
  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 05 Mar 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017