Search code examples
asp.netasp.net-mvcmodel-view-controllerbootstrap-table

RenderBody in ASP.Net MVC is in the wrong order for one page


Here is my situation: I am doing an ASP.Net MVC Web application and one of the page is not behaving normally.

Usually this is what it renders (visually): Navbar (I'm using Bootstrap), H1 Title of the page, Body of the page, Footer

But I have one page that behaves like this: Navbar, H1 Title of the page, Footer, Body of the page.

I tried to set a "Hello world" after my table (in the code) and this hello is at it's rightful place (between the h1 title and the footer).

The only difference with other pages is that this one is a table that is generated with a list of models. It is generated using the usual

foreach (var item in Model)
{
<tr>
Display each property of the item
<tr>
}

The model (when debugging) is not empty.

Any help will be greatly appreciated.


Solution

  • The error was simple enough, it failed the html validation, an end tag was missing. To fix it, simply use an online HTML validator.