none
re: MVC problem to list RRS feed

  • Question

  • Hi Guys

    I have a view in a database which returns a list of items based on a usereditID from the table

    the problem is that my listbox returns the right amount of rows but repeats the top row again and again

    Here is the controllercode:

            public ActionResult ViewPermissions(int id)
            {
                PermissionsModel model = new PermissionsModel();
                model.Apls = db.Vw_APL.Where(p => p.UserEditID == id).ToList() ;
                model.Bubs = db.Vw_BUP.Where(p => p.UserEditID == id).ToList();
                return View(model);
            } 
    
        }
    }

    And the view code:

        <div class="col-xs-6" style="padding-left:0">
            <label style="font-weight:bold">Business Units:</label>
            <ul style="background-color:#eee;height:150px;list-style:circle;font-size:12px;padding:20px;overflow: auto;">
                @foreach (var item in @Model.Apls)
                {
                    <li>@item.Application_Business_Unit_PermissionList</li>
                }
            </ul>
        </div>

    In my resultset, I am expecting 18 rows, and i get 18 rows but they are all the same entry

    I ran a profiler, and the query that the application executes returns all 18 rows as expected - i suspect its something ridiculously silly i have done here

    Any help would be great 

    thankyou

    James :D

    Friday, December 1, 2017 12:24 AM

Answers

All replies