or
$(document).ready(function () { Sys.Application.add_load(initContactsPage); });var contactsGrid = null;function initContactsPage(){ var contactsColumns = [{ field: "CustomerName", title: "Name", template: '<a class="name" href="ContactDetails.aspx?Id=#=CustomerID#">#=CustomerName#</a>' }, { field: "strCustomerNumber", title: "Number" }, { field: "strMainPhone", title: "Phone" }, { field: "strCity", title: "City" }, { field: "strWebsite", title: "Web Site" } ]; contactsGrid = $("#gvContacts").kendoGrid({ columns: contactsColumns, dataSource: new kendo.data.DataSource({ pageSize: 10, serverPaging: true, page: 1, schema: { total: "VirtualTotal", data: "Records" }, transport: { read: { url: "/Services/APIService.asmx/ListObjectRecords", type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", data: getData() } }, error: function (e) { } }), groupable: false, scrollable: false, pageable: true }).data("kendoGrid");}function searchContacts(page){ contactsGrid.dataSource.page(1);}function getData(){ var contactsParams = {}; contactsParams["objectId"] = "C9D9AEC9-F6C2-4EB3-8F00-D32A45A7C4C7"; contactsParams["textFilter"] = null; contactsParams["sortColumn"] = null; contactsParams["startIndex"] = 1; contactsParams["pageSize"] = 10; return JSON.stringify(contactsParams);}<ul data-role="listview" data-bind="source: exampleData" data-binding="onDataBinding" data-bound="onDataBound"></ul><script type="text/javascript"> function onDataBound (e) { console.log("this works"); } function onDataBinding (e) { console.log("this doesn't"); }</script>[HttpPost] public ActionResult AccountPopup_Create([DataSourceRequest] DataSourceRequest request, Account account ) { var result; return new JsonResult() { Data = result }; } [HttpPost] public ActionResult AccountPopup_Update([DataSourceRequest] DataSourceRequest request, Account account ) { var result; return new JsonResult() { Data = result }; }@model Account<table> <tr class="nameEditor"> <td class="editor-label">Dosya Adı </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Name, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Kaynak Adı </td> <td class="editor-field"> @Html.DropDownListFor(model => model.SourceId, new SelectList(GetSources(), "IntId", "Name"), new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Kaynak Profil Id </td> <td class="editor-field"> @Html.TextBoxFor(model => model.SourceAccountId, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Vergi Dairesi </td> <td class="editor-field"> @Html.TextBoxFor(model => model.TaxOffice, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Vergi Numarası </td> <td class="editor-field"> @Html.TextBoxFor(model => model.TaxNo, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Web Sitesi </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Website, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">E-Posta </td> <td class="editor-field"> @Html.TextBoxFor(model => model.EMail, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Telefon Numarası </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Tel, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Fax </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Fax, new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Profil Çeşidi </td> <td class="editor-field"> @Html.DropDownListFor(model => model.AccountType, new SelectList(ConfigModel.EnumToSelectList(typeof(AccountType)), "Value", "Text"), new { disabled = "disabled" }) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Senaryo Tipi </td> <td class="editor-field"> @Html.DropDownListFor(model => model.ScenarioType, new SelectList(ConfigModel.EnumToSelectList(typeof(ScenarioType)), "Value", "Text")) </td> </tr> <tr> <td colspan="2" style="height: 10px;"></td> </tr> <tr> <td colspan="2" style="padding-left: 20px;"><strong>Adres</strong></td> </tr> <tr> <td colspan="2" style="height: 10px;"></td> </tr> <tr class="nameEditor"> <td class="editor-label">Bina Adı </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Addresses[0].CityName) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Hesap Adı </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Addresses[0].AccountId) </td> </tr> <tr class="nameEditor"> <td class="editor-label">Mahalle Adı </td> <td class="editor-field"> @Html.TextBoxFor(model => model.Addresses[0].CitySubdivisionName) </td> </tr> </table>@(Html.Kendo().Grid(GetAccounts(AccountType.Customer)) .Name("accountsGrid") .Columns(columns => { columns.Bound(Account => Account.Name).HeaderTemplate("Profil Adı").Filterable(filterable => filterable.UI("accountNameFilter")).HtmlAttributes(new { title = " #= Name # " }); columns.Bound(Account => Account.TaxNo).HeaderTemplate("Vergi No").Filterable(filterable => filterable.UI("taxNoFilter")).Width(120); columns.ForeignKey(Account => Account.SourceId, GetSources(), "IntId", "Name").Title("Kaynak Adı").Width(200); columns.Bound(Account => Account.AccountType).HeaderTemplate("Hesap Tipi").Width(120); columns.Command(command => { command.Edit().Text("Güncelle").UpdateText("Güncelle").CancelText("İptal"); }).Width(105); }) .Filterable(filterable => filterable .Extra(false) ) .ToolBar(toolbar => toolbar.Create().Text("Yeni kayit ekle")) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("AccountEditPopup")) .Pageable(pager => pager .Messages(messages => messages.Display("{0} - {1}. Toplam {2} kayıt") .ItemsPerPage("") .First("İlk sayfa") .Last("Son sayfa") .Next("Sonraki") .Page("Sayfa") .Previous("Önceki") .Refresh("Yenile")) ) .Sortable() .Scrollable() .Events(e => e.Edit("onEdit")) .ClientDetailTemplateId("template") .DataSource(dataSource => dataSource .Ajax() .PageSize(30) .Model(model => { model.Id(p => p.IntId); }) .Events(events => events.Error("error_handler")) .Create(update => update.Action("AccountPopup_Create", "Config")) .Read(read => read.Action("AccountPopup_Read", "Config")) .Update(update => update.Action("AccountPopup_Update", "Config")) ) )/** * Scrolls the container to the top.*/reset: function() { this.movable.moveTo({x: 0, y: 0});},