Web Grid MVC
@model MvcApplication30.Models.PagedStudentModel
@{
ViewBag.Title = "WebGrid CRUD Operations";
WebGrid grid = new WebGrid(rowsPerPage: Model.PageSize);
grid.Bind(Model.It_Student,
autoSortAndPage: false,
rowCount: Model.TotalRows
);
}
Add New Student
@grid.GetHtml(
htmlAttributes: new { id = "grid" },
fillEmptyRows: false,
mode: WebGridPagerModes.All,
firstText: "<< First",
previousText: "< Prev",
nextText: "Next >",
lastText: "Last >>",
columns: new[] {
grid.Column("StudentID",
header: "ID", canSort: true),
grid.Column(header: "Student_Name",format: @ @item.Name @Html.TextBox("Student_Name_" + (int)item.StudentID, (string)item.Name, new { @style = "display:none" })),
grid.Column(header: "Branch",format: @ @item.Branch @Html.TextBox("Student_Branch_" + (int)item.StudentID, (string)item.Branch, new { @style = "display:none" })),
grid.Column(header: "City",format: @ @item.City @Html.TextBox("Student_City_" + (int)item.StudentID, (string)item.City, new { @style = "display:none" })),
grid.Column(header: "State",format: @ @item.State @Html.TextBox("Student_State_" + (int)item.StudentID, (string)item.State, new { @style = "display:none" })),
grid.Column
(header: "State",format:
@
@item.State
@*@Html.TextBox("Student_State_" + (int)item.StudentID, (string)item.State, new { @style = "display:none" })*@
@Html.DropDownList("Text", new SelectList(ViewBag.State, "Text", "Text"), "--Select--", new { @id = "Student_State_" + (int)item.StudentID, @class = "textfield" })
),@{
ViewBag.Title = "WebGrid CRUD Operations";
WebGrid grid = new WebGrid(rowsPerPage: Model.PageSize);
grid.Bind(Model.It_Student,
autoSortAndPage: false,
rowCount: Model.TotalRows
);
}
Add New Student
@grid.GetHtml(
htmlAttributes: new { id = "grid" },
fillEmptyRows: false,
mode: WebGridPagerModes.All,
firstText: "<< First",
previousText: "< Prev",
nextText: "Next >",
lastText: "Last >>",
columns: new[] {
grid.Column("StudentID",
header: "ID", canSort: true),
grid.Column(header: "Student_Name",format: @ @item.Name @Html.TextBox("Student_Name_" + (int)item.StudentID, (string)item.Name, new { @style = "display:none" })),
grid.Column(header: "Branch",format: @ @item.Branch @Html.TextBox("Student_Branch_" + (int)item.StudentID, (string)item.Branch, new { @style = "display:none" })),
grid.Column(header: "City",format: @ @item.City @Html.TextBox("Student_City_" + (int)item.StudentID, (string)item.City, new { @style = "display:none" })),
grid.Column(header: "State",format: @ @item.State @Html.TextBox("Student_State_" + (int)item.StudentID, (string)item.State, new { @style = "display:none" })),
grid.Column
(header: "State",format:
@
@item.State
@*@Html.TextBox("Student_State_" + (int)item.StudentID, (string)item.State, new { @style = "display:none" })*@
@Html.DropDownList("Text", new SelectList(ViewBag.State, "Text", "Text"), "--Select--", new { @id = "Student_State_" + (int)item.StudentID, @class = "textfield" })
grid.Column(header: "Action",format:@
})
Comments
Post a Comment