asp.net mvc - Uncaught TypeError: Object has no method 'addClass' - jquery.mobile-1.2.0.min.js:2 when dropdownlist source is empty -


i message in chrome's console. page keeps loading sign, nothing happens, freezes there, ui doesn't displayed. , happens when source of dropdownlistfor has no elements. if has any, works fine. here code: viewmodelfactory:

specialoffersrep specialoffersrep = new specialoffersrep(); ienumerable<specialofferbo> specialoffers = specialoffersrep.getfordropdown();  list<selectlistitem> specialoffersfordropdown = new list<selectlistitem>(); foreach (specialofferbo sp in specialoffers) {     specialoffersfordropdown.add(new selectlistitem { text = sp.specialoffername, value = sp.specialofferid.tostring() }); } ordervm.specialoffers = specialoffersfordropdown; return ordervm; 

so error when specialoffersfordropdown has no items.

and in view have this:

<tr>    <td>       @html.labelfor(m => m.specialofferid, new { @class = "label" })     </td>     <td>       @html.dropdownlistfor(m => m.specialofferid, model.specialoffers, new { data_mini = "true", id = "ddlspecialoffer" })      </td> </tr> 

i have created test project without jquery mobile , works fine empty datasource.

i have tried enumerable.empty<selectlistitem>() instead of model.specialoffers same error.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -