I have an asp mvc application. It has a layout page. like
Layout
<header>...</header>
<body>
<div main ...>
<footer>
<!--This is Where Error appears-->
@{Html.RenderPartial("~/Views/Shared/_Footer.cshtml");}
</footer>
</body>
<scripts ...
Another form that looks like
Contact Form this works
@model CHPIMSWebsite.Models.tblfeedback
<div class="container">
@using (Html.BeginForm(FormMethod.Post))
{
...
}
</div>
It works.
Now I have another form, similar but with only change that it also uploads an image but it is separate like..
SZBMU_Form causes conflicts
@model CHPIMSWebsite.Models.SZBMU_Form
<div class="container">
@using (Html.BeginForm("AddSZBMU_Form", "CHPIMS", FormMethod.Post, new { id = "myForm", FormMethod.Post, enctype = "multipart/form-data" }))
{
...
}
</div>
In case of Contact Us form nothing wrong happens, form loads properly but when I load SZBMU_Form it gives error as shown below. The footer page looks like this
This loads in footer
@model CHPIMSWebsite.Models.tblNewsLetter
<div class="container">
@using (Html.BeginForm(FormMethod.Post))
{
...
}
</div>
The model item passed into the dictionary is of type 'CHPIMSWebsite.Models.SZBMU_Form', but this dictionary requires a model item of type 'CHPIMSWebsite.Models.tblNewsLetter'
Why it conflicts in case of second form and not first while footer form is same in both cases. Is it any why with out specifying model in footer or using Viewmodel?