This is my code i am getting above said error :
@model IEnumerable
@{
ViewBag.Title = "SearchView";
WebGrid grid = new WebGrid();
}
SearchView
@using (Html.BeginForm("SearchView", "Search", FormMethod.Get))
{
@Html.AntiForgeryToken()
@foreach (var post in Model) {
Html.LabelFor(model => post.clearance_route, new { class = "control-label col-md-2" })
Html.EditorFor(model => post.clearance_route)
Html.ValidationMessageFor(model => post.clearance_route)
}
}
@{
var grid1 = new WebGrid(source: Model, canPage: true, rowsPerPage: 4, defaultSort: "line_segment");
@grid1.GetHtml(tableStyle: "PGrid", headerStyle: "Header", alternatingRowStyle: "altRow", htmlAttributes: new { id = "DataTable" }, columns: grid.Columns(
grid1.Column("clearance_route"),
grid1.Column("line_segment"),
grid1.Column("mile_post"),
grid1.Column("", header: "ToEdit", format: @@Html.ActionLink("Edit", "Edit", "Person", new { id = item.ID }, new { target = "_blank" }) )));
}
@Html.ActionLink("Back to List", "Index")
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Midhun TpPosted Aug 6, 2016, 2:24 AM
Vanaraj nPosted Aug 6, 2016, 1:20 AM
Midhun TpPosted Aug 6, 2016, 12:30 AM