Manoj Maharana

Manoj Maharana

  • NA
  • 362
  • 128.5k

Crud operation Of kendo ui Grid using json in MVC 5 C#

Mar 1 2017 5:44 AM

I want a kendo UI MVC 4 or 5 c# Grid with Add,Edit,Delete using ajax json and Sqlserver demo curd opeartion.

Any one can help me out..

Here i am using a simple method but it is not working properly..
 
  1.   <script>  
  2. $(function () {  
  3.   
  4.     var dataSource = new kendo.data.DataSource({  
  5.         transport: {  
  6.             read: {  
  7.                 url: "@Url.Action("GetAllUsers","Task")",  
  8.                 dataType: "json"  
  9.             },  
  10.             update: {  
  11.                 url: "@Url.Action("Edit","Task")",  
  12.                 dataType: "json",  
  13.                 contentType: "application/json;charset=utf-8",  
  14.                 type:"POST"  
  15.             },  
  16.             destroy: {  
  17.                 url: "@Url.Action("Delete","Task")",  
  18.                 dataType: "json",  
  19.                 contentType: "application/json;charset=utf-8",  
  20.                 type:"POST"  
  21.             },  
  22.             parameterMap: function(data,type)  
  23.             {  
  24.                 return kendo.stringify(data.models);  
  25.             }  
  26.         },  
  27.         schema: {  
  28.             model: {  
  29.                     id: "Id",  
  30.                     fields: {  
  31.                         Id: { editable: false },  
  32.                         UserName: { type: "string" },  
  33.                         FirstName: { type: "string" },  
  34.                         LastName: { type: "string" },  
  35.                         Address: { type: "string" },  
  36.                         IsActive: { type: "boolean" },  
  37.                         DateCreated: { type: "date" }  
  38.                     }  
  39.                 }  
  40.         },  
  41.         batch: true,  
  42.         pageSize: 20,  
  43.     });  
  44.   
  45.     $("#allUsers").kendoGrid({  
  46.         dataSource:dataSource,  
  47.         height: 550,  
  48.         groupable: true,  
  49.         sortable: true,  
  50.         navigatable: true,  
  51.         pageable: {  
  52.             refresh: true,  
  53.             pageSizes: true,  
  54.             buttonCount: 5  
  55.         },  
  56.         columns: [  
  57.         { field: "UserName",title: "User Name" },  
  58.         { field: "FirstName",title: "First Name" },  
  59.         { field: "LastName",title: "Last Name" },  
  60.         { field: "Address",title: "Address" },  
  61.         { field: "IsActive",title: "Active" },  
  62.         { field: "DateCreated",title: "Join Date",format: "{0:dd-MM-yyyy}" },  
  63.         { command: "destroy" }  
  64.         ],  
  65.         toolbar: ["save","cancel"],  
  66.         editable: {  
  67.             mode: "incell",  
  68.             update: true,  
  69.             destroy: true,  
  70.             confirmation:true  
  71.         },  
  72.         edit: function (event) {  
  73.             console.log("at edit event");  
  74.   
  75.         },  
  76.         save: function(event)  
  77.         {  
  78.             console.log("at saveChanges event");  
  79.         },  
  80.     });  
  81. });  
  82. </script>  

So any one can guide me??

Don't send me the link of telerik website..just give me a solutions or code..

I HAVE REFER THIS BLOG:
 
 http://www.mitechdev.com/2016/06/implementing-kendo-grid-with-crud-operations-in-aspnet-mvc.html
 
i want using json bind inline grid. 

Answers (2)