Adding item generates 'get_simpleRendering' obj error.

5 posts, 0 answers
  1. Chris
    Chris avatar
    3 posts
    Member since:
    Mar 2013

    Posted 07 Feb 2014 Link to this post

    I am adding items to the combobox using the examples given in the documentation and when I add an item I get an

    JavaScript runtime error: Object doesn't support property or method 'get_simpleRendering'. I have tried various ways to do this to no avail. Any ideas as to why I am getting this error?

    var combo = $find("<%= DayRadDropDownList.ClientID %>");
    var i = 1;
    for (i = 1; i <= mtype; i++) {
    var comboItem = new Telerik.Web.UI.RadComboBoxItem();
    comboItem.set_text("1");
    comboItem.set_value("1");
    combo.get_items().add(comboItem);
    }
  2. Chris
    Chris avatar
    3 posts
    Member since:
    Mar 2013

    Posted 07 Feb 2014 in reply to Chris Link to this post

    The line that is causing the problem is in the add. If I comment out this line it runs. I have tried different ways to write this to no avail. I did load a demo and it seems to work fine so I am thinking that it may be a conflict in how we have our site setup. Not sure.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Feb 2014 in reply to Chris Link to this post

    Hi Chris,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX;
    <telerik:RadComboBox ID="DayRadDropDownList" runat="server" OnClientLoad="AddItem">
    </telerik:RadComboBox>

    JavaScript:
    <script type="text/javascript">
        function AddItem(sender, args) {
            var combo = $find("<%= DayRadDropDownList.ClientID %>");
            var mtype = 5;
            sender.trackChanges();
            for (i = 1; i <= mtype; i++) {
                var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                comboItem.set_text(i.toString());
                comboItem.set_value("1");
                combo.get_items().add(comboItem);
            }
            sender.commitChanges();
        }
    </script>

    Let me know if you have any concern.
    Thanks,
    Shinu.
  5. Murali Karlapudi
    Murali Karlapudi avatar
    7 posts
    Member since:
    Jun 2009

    Posted 08 May 2015 in reply to Chris Link to this post

    Replacethis line 

    var comboItem = new Telerik.Web.UI.RadComboBoxItem();

    with

      var comboItem = new Telerik.Web.UI.DropDownListItem();

    *it worked for me

    i followed  telerik documentaion  here http://www.telerik.com/help/aspnet-ajax/combobox-client-side-radcomboboxitemcollection.html  and got the same problem. while debugging the combo.get_items().  the type of the item is Telerik.Web.UI.DropDownListItem.

  6. Dimitar
    Admin
    Dimitar avatar
    281 posts

    Posted 13 May 2015 Link to this post

    Hi all,

    @Chris,

    Shinu's approach, which is an example for the add() method in Murali's help article, works without errors on my side. You may give it a try and reply, if you have further questions.

    @Murali,

    The Telerik.Web.UI.DropDownListItem() constructor that you used was most probably needed, because you were using a RadDropDownList control, instead of RadComboBox. By implementing a RadComboBoxItem() constructor for RadDropDownList, you ran into an error when following the RadComboBox help article.

    Regards,
    Dimitar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017