Wednesday, 30 August 2017

Adding checkbox in the column of the webgrid in razor MVC3

Add HTML input type in the column of webgrid which is something like this…

grid.Column(header: "CheckBox", format: @<text><input name="checkbox" type="checkbox" value="@item.ID" /></text>)

So your whole webgrid coding will look something like this….
@{
var grid = new WebGrid(source: Model,
        rowsPerPage: 40);
}
@grid.GetHtml(
        tableStyle: "grid",
        headerStyle: "head",
        alternatingRowStyle: "alt",
                columns: grid.Columns(
                          grid.Column("Column1"),
                          grid.Column("Column2"),
                         grid.Column(header: "CheckBox", format: @<text><input name="checkbox" type="checkbox" value="@item.ID" /></text>)
        )
    )

No comments:

Post a Comment

React Hooks - custom Hook

  v CustomHook Ø React allows us to create our own hook which is known as custom hook. Example – 1 localStorage Demo Step-1 Create ...