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

Adding item generates 'get_simpleRendering' obj error.

4 Answers 40 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 07 Feb 2014, 02:53 PM
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);
}

4 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 07 Feb 2014, 04:30 PM
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.
0
Shinu
Top achievements
Rank 2
answered on 10 Feb 2014, 06:47 AM
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.
0
Murali Karlapudi
Top achievements
Rank 2
answered on 08 May 2015, 01:42 PM

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.

0
Dimitar
Telerik team
answered on 13 May 2015, 01:11 PM
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
Tags
ComboBox
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Murali Karlapudi
Top achievements
Rank 2
Dimitar
Telerik team
Share this question
or