asp.net mvc 5 - LINQ: .Select infinite loop -


i getting appears infinite loop in either linq or somehow jquery. it keeps calling controller method on , over. here's controller method:

    public actionresult index()     {         // todo: decide properties determine need user action (the 'where(s)')         var viewmodel = new prioritytasksviewmodel         {             bayoptions = _bayoptionrepository.getbayoptions()                 .where(x => x.isactive && !x.sitevisibilityflagsoverride).tolist()                 .select(x => new prioritytasksbayoptionsviewmodel()                  {                     bayguid = x.bayguid,                      baynumber = x.baynumber,                      propertyid = x.propertyid                 })                 .tolist(),             properties = _propertyrepository.getproperties()                 .where(x => !x.sitevisibilityflagsoverride).tolist()                 .select(x => new prioritytaskspropertiesviewmodel()                  {                     propertyid = x.propertyid,                      propertyname = x.name                 })                 .tolist()         };         return view("_prioritytasks", viewmodel);     } 

if put breakpoint in view, verify it's looping. missing in linq? put .tolist() in there force loading but... view:

<h6>properties</h6>  <table class="table"> <tr>     <th>         name     </th>        </tr> @foreach (var item in model.properties) { <tr>     <td>         <a href="@(url.action("edit", "property"))">@html.displayfor(modelitem => item.propertyname)</a>     </td> </tr> } </table> 

and jquery @ bottom of _layout:(it has show on teh menu of layout)

 $(document).ready(function () {     $('#prioritytasks').load('@url.action("index", "prioritytask")'); }) 

maybe need return partial view instead

return partialview("_prioritytasks", viewmodel); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -