我想知道如何在单击按钮时将文本框值(webgrid文本框列)传递给Controller?我尝试了几种解决方案,但它从未对我有用。
我的代码示例将帮助我理解。谢谢!
Index.cshtml
var grid = new WebGrid(Model,
defaultSort: "Number",
rowsPerPage: 10,
ajaxUpdateContainerId: "searchResults");
@grid.GetHtml(mode: WebGridPagerModes.All,
htmlAttributes: new { id = "searchResults" },
columns: new[] {
grid.Column("Id"),
grid.Column("Date"),
grid.Column("Status"),
grid.Column("Reason", format:(item) => Html.TextBox("Reason", (object) item.Reason))
});
<input id="IDSubmit" type="submit" value="Submit" />