form tag does not show
Using开发者_开发百科 asp.net mvccontrib grid. When using the custom column, the form tag isn't shown:
@(Html.Grid<SomeModelType>(Model.PagedList)
.Columns(columns =>
{
columns.Custom(
@<text>
@using(Html.BeginForm("DeleteAction", "Controller", new { Id=@item.UserId}))
{
<input type="submit" value="Delete" />
}
</text>
);
})
.Sort(Model.GridSortOptions)
)
It outputs: <input type="submit" value="Delete" />
in the column.
Try like this:
@(Html
.Grid<MyViewModel>(Model)
.Columns(columns =>
{
columns.Custom(model => Html.Partial("_DeleteLink", model));
})
.Sort(Model.GridSortOptions)
)
and inside the _DeleteLink.cshtml
partial:
@model SomeModelType
@using(Html.BeginForm("DeleteAction", "Controller", new { id = Model.UserId }))
{
<input type="submit" value="Delete" />
}
Why would you use @<text> </text>
?
精彩评论