c# - How to bind a telerik grid to a controller action -


the following code returning me data in json in browser, not displaying telerik mvc grid.

public class tipodecanalescontroller : genericcontroller {     private unitofwork unitofwork = new unitofwork();      // get: tipodecanales     public actionresult index([datasourcerequest] datasourcerequest request)     {         return json(unitofwork.tipodecanalrepository.get(),jsonrequestbehavior.allowget);     } 

and view

@model ienumerable<powerdata.comisiones.models.tipodecanal>      @{         viewbag.title = "index";     }      <h2>index</h2>      @(html.kendo().grid(model)     .name("grid")     .columns(columns =>     {         columns.bound(p => p.id);         columns.bound(p => p.nombre).title("nombre");         columns.bound(p => p.descripcion).title("descripcion");     })     .toolbar(toolbar => toolbar.create())     .editable(editable => editable.mode(grideditmode.popup))     .pageable()     .sortable()     .scrollable(scr => scr.height(430))     .filterable()     .datasource(datasource => datasource         .ajax()         .pagesize(20)         .events(events => events.error("error_handler"))         .model(model => model.id(p => p.id))         .create(update => update.action("editingpopup_create", "grid"))         .read(read => read.action("index", "grid"))         .update(update => update.action("editingpopup_update", "grid"))         .destroy(update => update.action("editingpopup_destroy", "grid"))      )     )     %>     <script type="text/javascript">         function error_handler(e) {             if (e.errors) {                 var message = "errors:\n";                 $.each(e.errors, function (key, value) {                     if ('errors' in value) {                         $.each(value.errors, function () {                             message += + "\n";                         });                     }                 });                 alert(message);             }         }     </script> 

i have problem.

when use more 1 jquery library happen . add 1 jquery library .

change return result :

return json(result.todatasourceresult(request), jsonrequestbehavior.allowget); 

sory can add comment .


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -