I'm currently working on a project in MVC3 where I need to create a dynamic table.
However, I've encountered an issue where the table extends beyond the page layout and doesn't stay contained within the shared div.
@{
ViewBag.Title = "Users";
}
<h2>Users</h2>
<p>
@Html.ActionLink("Create New User", "Create")
</p>
<table>
<tr>
<th>
UserID
</th>
<th>
UserName
</th>
<th>
UserForename
</th>
<th>
PW
</th>
<th>
UserTypeID
</th>
<th>
PasswordMustBeChanged
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.U1_UserId)
</td>
<td>
@Html.DisplayFor(modelItem => item.U1_UserName)
</td>
<td>
@Html.DisplayFor(modelItem => item.U1_UserForename)
</td>
<td>
@Html.DisplayFor(modelItem => item.U1_PW)
</td>
<td>
@Html.DisplayFor(modelItem => item.U1_UserTypeID)
</td>
<td>
@Html.DisplayFor(modelItem => item.U1_PasswordMustBeChanged)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.U1_UserId }) |
@Html.ActionLink("Delete", "Delete", new { id=item.U1_UserId })
</td>
</tr>
}
The table is supposed to render inside the shared layout using @renderbody. However, it seems to be going outside of the designated div container. Any suggestions on how to fix this?