3
Answers

CRUD in MVC kendogrid using custom commands

Dipika

Dipika

7y
229
1
@(Html.Kendo().Grid()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(e => e.U_ID).Visible(false);
columns.Bound(e => e.FirstName).Title("First Name");
columns.Bound(e => e.LastName).Title("Last Name");
columns.Bound(e => e.Username).Title("User Name");
columns.Bound(e => e.Password).Title("Password").ClientTemplate("#: Array(data.Password.length).join('*') #").EditorTemplateName("password");
columns.Bound(e => e.Group_Name).Title("Group").EditorTemplateName("_AdminUserGroup").ClientTemplate("#: Group_Name #");
columns.Bound(e => e.Active).Title("Active").ClientTemplate("
");
columns.Command(command => command.Custom("Edit").Click("onEdit"));
columns.Command(command => command.Custom("Delete").Click("onDelete"));
})
.ToolBar(toolBar => toolBar.Template("Add new record"))
.Selectable(selectable => selectable.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Events(m =>
{
m.Change("onChangeUserGrid");
m.Edit("onEdit");
m.Remove("onDelete");
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.U_ID);
model.Field(p => p.Active).Editable(false);
})
.Read(read => read.Action("GetCompanyUsers", "Inspire").Data("CheckUserID")
))
)
 
 
Command using jqeury not working
Answers (3)
0
Dipika

Dipika

NA 1.2k 14.6k 7y
I want it using custom commands
0
Rajkiran Swain

Rajkiran Swain

NA 33.9k 373.2k 7y
Add <script src="~/Scripts/jquery-2.2.3.js"></script> in top code
0
Dipika

Dipika

NA 1.2k 14.6k 7y
i got one on this http://www.c-sharpcorner.com/article/crud-in-kendo-grid-using-asp-net-mvc-and-entity-framework/
but den what about the text field validation on edit and add button