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

'attributes' is null

1 Answer 43 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
msigman
Top achievements
Rank 2
msigman asked on 21 Feb 2011, 07:23 PM

When attempting to add a simple unordered list template to a RadComboBox with EnableLoadOnDemaned=true, I get this javascript error: 'attributes' is null or not an object.

<HeaderTemplate><ul></HeaderTemplate>
<ItemTemplate>
    <li><%# Container.Text %></li>
</ItemTemplate>
<FooterTemplate></ul></FooterTemplate>


Also tried accessing the DataItem property directly with the exact same result:

<HeaderTemplate><ul></HeaderTemplate>
<ItemTemplate>
    <li><%# DataBinder.Eval(Container.DataItem, "Name") %></li>
</ItemTemplate>
<FooterTemplate></ul></FooterTemplate>

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 24 Feb 2011, 04:14 PM
Hi Msigman,

The reason your are getting this error is because with the following declaration provided you are messing the combobox item rendering. The first problem is that header template and footer templates are placed in different divs then the items of the combobox. Thus putting ul open tag in the header is absolutely useless since the browser is automatically adding the closing tag. On other hand it is ignoring the closing </ul> tag  in the footer template and it;s empty. The error occurs since the text of each item is enclosed in <li></li> tags and as you add another set of <li></li> tags  is causing a confusion for the browser and this is how the error is reproduced. If you still want to have a list looking template for the combobox  items , you have to add both ul and li tags for each item:
<ItemTemplate>
     <ul>
         <li>
             <%# DataBinder.Eval(Container,"Text") %>
         </li>
     </ul>
 </ItemTemplate>



Best wishes,
Dimitar Terziev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
ComboBox
Asked by
msigman
Top achievements
Rank 2
Answers by
Dimitar Terziev
Telerik team
Share this question
or