我想在我的webgrid中添加复选框,所以任何人都可以告诉我该怎么做?并告诉我如何选择所有复选框并删除它们。这是我的代码: -
@{
var grid = new WebGrid(
Model, rowsPerPage: 5,
defaultSort: "CatagoryId",
columnNames: new[] { "Category_Name", "Parent_Category_ID", "Category_Desc", "IsGenderApplicable", "IsAgeApplicable", "IsActive" }
);
}
@grid.GetHtml(
fillEmptyRows: false,
mode: WebGridPagerModes.All,
columns:grid.Columns(
grid.Column("Category_Name", header: "Catagory Name"),
grid.Column("Parent_Category_ID", header: "Parant CatID"),
grid.Column("Category_Desc", header: "Description"),
grid.Column("IsGenderApplicable", header: "Gender Application"),
grid.Column("IsAgeApplicable", header:"Age Application"),
grid.Column("IsActive", header: "Active")
)
)
答案 0 :(得分:1)
添加一个复选框:
grid.Column(format: @<text><input name="chkbox"
type="checkbox" value="some value" /></text>),
您的第二个问题:如何选择所有复选框?
请参阅此博客:http://www.codeproject.com/Questions/273164/mvc-checkbox-checked-rows-in-the-web-grid