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)

    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 


    James :D

    Friday, December 1, 2017 12:24 AM


All replies

  • This is the C# language forum. That view code is not C#.

    C# is case-sensitive so "model"  is not the same as "Model"; I don't know if that is relevant.

    Sam Hobbs

    Friday, December 1, 2017 2:03 AM
  • Any help would be great 


    • Marked as answer by James OHara Friday, December 1, 2017 8:26 AM
    Friday, December 1, 2017 3:14 AM