I use asp.net mvc 5. I created popup window in my layout page above render body element:
<div class="body-content" style="padding-left:15px;padding-right:15px;">
<!-- Subscribers popup -->
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Body -->
<div class="modal-body">
@Html.Partial("~/Views/Account/Login.cshtml")
</div>
</div>
</div>
</div>
<!-- /Subscribers popup -->
@RenderBody()
</div>
here how looks Login.cshtml:
@model GeomindEnterprise.Models.LoginViewModel
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6">
<!-- /SOCIAL LOGIN -->
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "sky-form", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<label class="input margin-bottom-10">
<i class="ico-append fa fa-envelope"></i>
@Html.TextBoxFor(m => m.UserName, new { @placeholder = "Email" })
@Html.ValidationMessageFor(m => m.UserName, "", new { @class = "text-danger" })
</label>
<label class="input margin-bottom-10">
<i class="ico-append fa fa-lock"></i>
@Html.PasswordFor(m => m.Password, new { placeholder = "Password" })
@Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
</label>
<label class="form-group">
@Html.CheckBoxFor(m => m.RememberMe, new { @class = "col-md-1" })
@Html.LabelFor(m => m.RememberMe)
</label>
<footer>
<button type="submit" class="btn btn-default noradius pull-right"><i class="fa fa-check"></i> OK, LOG IN</button>
</footer>
}
</div>
</div>
also in layout page I have this navigation bar:
<div class="navbar-collapse pull-left nav-main-collapse collapse">
<nav class="nav-main">
<ul id="topMain" class="nav nav-pills nav-main">
<li>@Html.ActionLink(@Resources.Resources.Home, "Index", "Home")</li>
<li>@Html.ActionLink(@Resources.Resources.About, "About", "Home")</li>
<li>@Html.ActionLink(@Resources.Resources.Contact, "Contact", "Home")</li>
<li><a href="#" data-toggle="modal" data-target="#myModal">@Resources.Resources.Subscribers</a></li>
@if (Request.IsAuthenticated && User.IsInRole("Admin"))
{
<li>@Html.ActionLink("Back office", "BackOfficeMain", "BackOffice")</li>
<li>@Html.ActionLink("RolesAdmin", "Index", "RolesAdmin")</li>
<li>@Html.ActionLink("UsersAdmin", "Index", "UsersAdmin")</li>
<li>@Html.ActionLink("GroupsAdmin", "Index", "GroupsAdmin")</li>
}
</ul>
</nav>
</div>
While when I click Back office or RolesAdmin or UsersAdmin or GroupsAdmin I get this error:
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[GeomindEnterprise.Models.ApplicationUser]', but this dictionary requires a model item of type 'GeomindEnterprise.Models.LoginViewModel'.
on this row:
@Html.Partial("~/Views/Account/Login.cshtml")
Any idea why I get error above and how can I prevent the error above?