c# - jqGrid ASP.NET WebForms cellurl doesn't work -


i edit data in grid. can edit in table , see don't go c# method. tried ajax doesn't work too...serialization doesn't work too. wrong?

    [webmethod]     public static string loaddata()     {         sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings["conn"].connectionstring);         sqldataadapter da = new sqldataadapter("select * employees", cn);         dataset ds = new dataset();         da.fill(ds);         return jsonconvert.serializeobject(ds.tables[0]);     }      [webmethod]     public void updategrid()     {         //code update database         sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings["conn"].connectionstring);         sqldataadapter da = new sqldataadapter("select * employees", cn);     } } 

and js:

$(document).ready(function () {         $("#btnemployee").click(function () {             var service = "default.aspx/loaddata";             var lastsel2;             $.ajax({                 url: service,                 datatype: "json",                 data: "{}",                 contenttype: "application/json; charset=utf-8",                 method: "post",                 success: function (result) {                     result = result.d;                     jquery("#emptable").jqgrid({                         datatype: "local",                         colnames : ['emp numb', 'first name', 'second name', 'salary'],                         colmodel: [                             { name:"emp_id", index: "emp_id", width:80, editable: true},                             { name: "first_name", index: "first_name", width: 80, editable: true},                             { name: "second_name", index: "second_name", width: 80, editable: true},                             { name: "salary", index: "salary", width: 80, editable: true}                         ],                         data: json.parse(result),                         rownum: 10,                         loadonce: true,                         rowlist: [5, 10, 20],                         pager: '#emppager',                         viewrecords: true,                         sortorder: 'asc',                         gridview: true,                         autowidth: true,                         sortname: 'emp_id',                          altrows: true,                         hoverrows: true,                          onselectrow: function (id) {                             if (id && id !== lastsel2) {                                 jquery('#emptable').restorerow(lastsel2);                                 jquery('#emptable').editrow(id, true);                                 lastsel2 = id;                             }                          },                         caption: "events",                         cellurl: 'default.aspx/updategrid'                     });                     $("#emptable").jqgrid('navgrid', '#emppager', { edit: true, add: true, del: false });                     $("#emptable").jqgrid('inlinenav', "#emppager");                      },                 error: function (error) {                     alert("oops!");                 }             });         });                  }); 


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -