Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Really struggling with this.
I have a partial view which uses an IEnumerable model (returning data as a list)
---umbraco template---
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Master.cshtml";
}
@Html.Partial("AgeGate", new IEnumerable<Example.Models.Products>) //want to call the PartialView
----Partial View---
@model IEnumerable<Example.Models.Products>
ViewBag.Title = "Index";
<h2>Index</h2>
@foreach (var item in Model)
{<text>TEST</text>}
--Controller---
public class AgeGateController : SurfaceController
{
public PartialViewResult AgeGate()
var alldat = db.tblAgeGates; //gets db results
return PartialView(alldat.ToList()); //return List
Q. What do I need to do correctly call the IEnumerable model ?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Partial View and IEnumerable Model
Really struggling with this.
I have a partial view which uses an IEnumerable model (returning data as a list)
---umbraco template---
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Master.cshtml";
}
@Html.Partial("AgeGate", new IEnumerable<Example.Models.Products>) //want to call the PartialView
----Partial View---
@model IEnumerable<Example.Models.Products>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
@foreach (var item in Model)
{<text>TEST</text>}
--Controller---
public class AgeGateController : SurfaceController
{
public PartialViewResult AgeGate()
{
var alldat = db.tblAgeGates; //gets db results
return PartialView(alldat.ToList()); //return List
}
}
Q. What do I need to do correctly call the IEnumerable model ?
is working on a reply...