or
$(document).ready(
function
() {
dataSource =
new
kendo.data.DataSource({
transport: {
read: {url:
"<?=base_url()?>/bank"
},
create: {url:
"<?=base_url()?>/bank/create"
,type:
"POST"
},
update: {url:
"<?=base_url()?>/bank/update"
, type:
"POST"
},
destroy: {url:
"<?=base_url()?>/bank/destroy"
,type:
"POST"
},
},
batch:
true
, pageSize: 25,
schema: {
model: {
id:
"id_bank"
,
fields: {
nama_bank: { type:
"string"
},
}
}
}
});
//kendo grid
$(
"#grid_bank"
).kendoGrid({
dataSource: dataSource, editable:
"popup"
, height: 450,
filterable:
true
, sortable:
true
, pageable:
true
,
toolbar: [
"create"
],
columns: [
{ field:
"nama_bank"
,title:
"Nama"
, filterable:
true
},
{ command: [
"edit"
,
"destroy"
], title:
" "
, width:
"160px"
}
]
});
});
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Services;
namespace WebApplication3
{
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static IEnumerable<
Comuni
> ListaComuni()
{
using (var northwind = new DataClasses1DataContext())
{
var lista = northwind.CAPCOM.Where(row=> row.CapComId<
100
)
// Use a view model to avoid serializing internal Entity Framework properties as JSON
.Select(p => new Comuni()
{
CapComId = p.CapComId,
CapComCod = p.CapComCod,
CapComCom = p.CapComCom
})
.ToList();
return lista;
}
}
public class Comuni
{
public int CapComId { get; set; }
public string CapComCod { get; set; }
public string CapComCom { get; set; }
public int Total { get; set; }
}
}
}