public int ID { get; set; } public string Name { get; set; } public string SurName { get; set; } public static List<UserModel> getUsers() { List<UserModel> users = new List<UserModel>() { };
@{ var grid = new WebGrid(Model); } <div id="gridContent" style=" padding:20px; " > @grid.GetHtml( tableStyle: "webgrid-table", headerStyle: "webgrid-header", footerStyle: "webgrid-footer", alternatingRowStyle: "webgrid-alternating-row", selectedRowStyle: "webgrid-selected-row", rowStyle: "webgrid-row-style", mode: WebGridPagerModes.All, columns: grid.Columns( grid.Column("ID", format: @<text> <span class="display-mode">@item.ID </span> <label id="UserID" class="edit-mode">@item.ID</label> </text>, style: "col1Width" ), grid.Column("Name", "Name", format: @<text> <span class="display-mode"> <label id="lblName" >@item.Name</label> </span> <input type="text" id="Name" value="@item.Name" class="edit-mode" /></text>, style: "col2Width"), grid.Column("SurName", "Sur Name", format: @<text> <span class="display-mode"> <label id="lblSurName">@item.SurName</label> </span> <input type="text" id="SurName" value="@item.SurName" class="edit-mode" /> </text>, style: "col2Width"), grid.Column("Action", format: @<text> <button class="edit-user display-mode" >Edit</button> <button class="save-user edit-mode" >Save</button> <button class="cancel-user edit-mode" >Cancel</button> </text>, style: "col3Width" , canSort: false) ))