Hi I have a WebGrid with two columns:
1-Name
2-Action binded to another controller action. On click i will re-direct to that action, parameter should be a List ofList<Test>
items.
Output: Request goes to Controller but parameter is empty colelction, am i missing anything.
View:
@model IEnumerable<Test>
<div id="testGrid">
@{
var grid = new WebGrid(ajaxUpdateContainerId: "testGrid", canSort: true);
grid.Bind(Model);
@MvcHtmlString.Create(
@grid.GetHtml(
columns: grid.Columns
(
grid.Column(Html.DisplayNameFor(model => model.Name).ToHtmlString(),
header: Html.DisplayNameFor(model => model.Name).ToHtmlString()),
grid.Column("Action", header: "Action", format: @<a href="@Url.Action("LoadTest", "NewController",
new
{
ingredients = Model.Select(t=>t.Id==@item.Id).ToList()
}
)" class="edit-btn"></a>)
)
).ToString()
)
}
</div>
Controller code
List coming empty.
public ActionResult LoadTest(List<Test> testItems)
{
//...test code.
}