Error in MVC:The model item passed into the dictionary is of type System.Collections.Generic.List1
var detail = (from p in db.Partner_Details
join h in db.Height_Table on p.Height_min equals h.Height_Id
join h1 in db.Height_Table on p.Height_max equals h1.Height_Id
join r in db.Religions on p.Religion equals r.Religion_Id
join c in db.Castes on p.Caste equals c.Caste_Id
join m in db.Marital_Status on p.Marital_Status equals m.Status_Id
join mt in db.Mother_Tongue on p.Mother_Tongue equals mt.Language_id
join ct in db.Country_Name on p.Country_of_Resident equals ct.Country_Id
join st in db.State_Name on p.State_of_Resident equals st.State_Id
join e in db.Education_Qualification on p.Education_Qualification equals e.Education_Id
join anlincm in db.AnnuaIncome_Table on p.Annual_Income equals anlincm.Income_Id
join mn in db.Manglik_Table on p.Manglik equals mn.Manglik_Id
join sc in db.SpecialCase_Table on p.Special_Cases equals sc.SpecialCase_Id
join d in db.Diet_Table on p.Diet equals d.Diet_Id
select new partnerDetails
{
Age_from = p.Age_from,
Age_to = p.Age_to,
Height_Min = h.Height,
Height_Max = h1.Height,
Relegions = r.Religion_Name,
Castes = c.Caste1,
Marital_status = m.Status,
Mother_tongue = mt.Language,
Country_of_resident = ct.Country,
State_of_resident = st.State,
Education_qualification = e.Education,
Annual_income = anlincm.Annual_Income,
Mangliks = mn.Manglik,
Special_cases = sc.Special_Case,
Diets = d.Diet
}
).ToList();
return View(detail.ToList());
@model Wedding_Plan.Wedding_Repository.partnerDetails
@{
ViewBag.Title = "Partner_Details";
Layout = "~/Views/Shared/_Layout_Inner.cshtml";
}
<h2>Partner_Details</h2>
<div>
<h4>users_details</h4>
<hr />
<dl class="dl-horizontal">
<dd>
@Html.DisplayFor(model => model.Age_from)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Age_from)
</dt>
<dd>
@Html.DisplayFor(model => model.Age_to)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Age_to)
</dt>
<dd>
@Html.DisplayFor(model => model.Height_Min)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Height_Min)
</dt>
<dd>
@Html.DisplayFor(model => model.Height_Max)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Height_Max)
</dt>
</dl>
</div>