asp.net - editURL not being called - JQGrid -


i have editable jqgrid, inline editing events, editurl not being called. edit data web method in vb.net. when click on row row becomes editable , able make changes when hit enter editurl not being called. please suggest changes necessary.

<scriptmethod(responseformat:=responseformat.json)> _ <webmethod()> _ public shared function loaddata() jqgridresult      'if mulist.selectedvalue <> "0" andalso mulist.selectedvalue <> string.empty     '    hirnodemu = hirnodemu.parse(mulist.selectedvalue)     'else     '    hirnodemu = 0     'end if      'dim hirnode integer = hirnodemu     'if hirnode = 0     '    hirnode = hirnodecurrent     'end if      dim sidx string = ""     dim sord string = "asc"     dim page integer = 1     dim rows integer = 1000      dim entryfieldsonly integer = 1      dim hirnode integer = 5     dim fiscalyear integer = 2012     dim fiscalperiod integer = 3      dim dtwordata datatable = new datatable()      dim connectstring string = configurationsettings.appsettings("dbconnection")      using sqlconnection new sqlconnection(connectstring)          dim conn sqlconnection = new sqlconnection(connectstring)         dim cmd sqlcommand = new sqlcommand("finworfactview", conn)         cmd.commandtype = commandtype.storedprocedure         cmd.parameters.add("@hirnodebase", sqldbtype.int, 4).value = hirnode         cmd.parameters.add("@fiscalyear", sqldbtype.int, 4).value = fiscalyear         cmd.parameters.add("@fiscalperiod", sqldbtype.int, 4).value = fiscalperiod         cmd.parameters.add("@entryfieldsonly", sqldbtype.int, 4).value = entryfieldsonly         conn.open()          dim da sqldataadapter = new sqldataadapter(cmd)          da.fill(dtwordata)      end using      dim pageindex integer = page     dim pagesize integer = rows     dim startrow integer = (pageindex * pagesize) + 1     dim totalrecords integer = dtwordata.rows.count()     dim totalpages integer = cint(math.ceiling(csng(totalrecords) / csng(pagesize)))      dim row list(of jqgridrows) = new list(of jqgridrows)      integer = 0 dtwordata.rows.count - 1          dim newrow jqgridrows = new jqgridrows          newrow.id = convert.toint32(dtwordata.rows(i)("displayorder"))          newrow.cell(0) = dtwordata.rows(i)("displayorder").tostring()         newrow.cell(1) = dtwordata.rows(i)("columnposition").tostring()         newrow.cell(2) = dtwordata.rows(i)("columnname").tostring()         newrow.cell(3) = dtwordata.rows(i)("week1").tostring()         newrow.cell(4) = dtwordata.rows(i)("week2").tostring()         newrow.cell(5) = dtwordata.rows(i)("week3").tostring()         newrow.cell(6) = dtwordata.rows(i)("week4").tostring()         newrow.cell(7) = dtwordata.rows(i)("week5").tostring()         newrow.cell(8) = dtwordata.rows(i)("dbfieldname").tostring()         newrow.cell(9) = dtwordata.rows(i)("updateable").tostring()         newrow.cell(10) = dtwordata.rows(i)("payrollactive").tostring()         newrow.cell(11) = dtwordata.rows(i)("purchasingactive").tostring()         newrow.cell(12) = dtwordata.rows(i)("hirnode").tostring()         newrow.cell(13) = dtwordata.rows(i)("finwor1").tostring()         newrow.cell(14) = dtwordata.rows(i)("finwor2").tostring()         newrow.cell(15) = dtwordata.rows(i)("finwor3").tostring()         newrow.cell(16) = dtwordata.rows(i)("finwor4").tostring()         newrow.cell(17) = dtwordata.rows(i)("finwor5").tostring()         newrow.cell(18) = dtwordata.rows(i)("finworp").tostring()         newrow.cell(19) = dtwordata.rows(i)("total").tostring()         newrow.cell(20) = dtwordata.rows(i)("projection").tostring()         newrow.cell(21) = dtwordata.rows(i)("healthcareactive").tostring()          row.add(newrow)     next      dim result jqgridresult = new jqgridresult      result.total = totalpages     result.page = page     result.records = totalrecords     result.rows = row      return result  end function  <scriptmethod(responseformat:=responseformat.json)> _ <webmethod()> _ public shared function editdata(byval week1 string, byval week2 string, byval week3 string, byval week4 string, _                                 byval week5 string, byval projection string, _                                 byval dbfieldname string, byval hirnode string, _                                 byval finwor1 string, byval finwor2 string, byval finwor3 string, byval finwor4 string, _                                 byval finwor5 string, byval finworp string, byval healthcareactive string, _                                 byval oper string, byval id string) boolean      dim objclass new _default     objclass.logerror(week1 + " " + week2 + " " + week3 + " " + week4 + " " + week5 + " " + projection)      return true  end function 

this firebug - request body week1=+767%2c077+&week2=+727%2c055+&week3=+719%2c411+&week4=+738%2c102+&week5=+290%2c921+&projection=false&dbfieldname=false&hirnode=&finwor1=&finwor2=&finwor3=&finwor4=&finwor5=+3%2c242%2c566+&finworp=+2%2c869%2c267+&healthcareactive=false&oper=edit&id=14

js code

jquery(document).ready(function($) {  var lastsel;  $(document).ready(function() {       loadgrid(); });  function loadgrid() {     jquery("#tblwor").jqgrid({         url: 'default.aspx/loaddata',         mtype: 'post',         datatype: 'json',         ajaxgridoptions: { contenttype: 'application/json; charset=utf-8' },         serializegriddata: function(postdata) {             return json.stringify(postdata);         },         rownum: 1000,         width: 1200,         height: 'auto',         colnames: ['display order', 'column p', 'column n', 'week1(1-7)', 'week2(8-14)', 'week2(15-21)', 'week1(22-28)', 'week1(29-31)',                     'total month' + '</br>' + 'to date', 'projection' + '</br>' + 'for month',                     'dbfieldname', 'updateable', 'payrollactive', 'purchasingactive', 'hirnode',                     'wor1', 'wor2', 'wor3', 'wor4', 'wor5', 'worp', 'healthcareactive',                 ],         colmodel: [                 { name: 'displayorder', index: 'displayorder', hidden: true },                 { name: 'coulumnposition', index: 'week1', width: 55 },                 { name: 'columnname', index: 'week1', width: 80 },                 { name: 'week1', index: 'week1', width: 55, editable: true, edittype: 'text' },                 { name: 'week2', index: 'week2', width: 55, editable: false, edittype: 'text' },                 { name: 'week3', index: 'week3', width: 55, editable: false, edittype: 'text' },                 { name: 'week4', index: 'week4', width: 55, editable: false, edittype: 'text' },                 { name: 'week5', index: 'week5', width: 55, editable: false, edittype: 'text' },                 { name: 'total', index: 'total', width: 55 },                 { name: 'projection', index: 'projection', width: 55, editable: false, edittype: 'text' },                 { name: 'dbfieldname', index: 'dbfieldname', editable: false, hidden: true },                 { name: 'updateable', index: 'updateable', editable: false, hidden: true },                 { name: 'payrollactive', index: 'payrollactive', editable: false, hidden: true },                 { name: 'purchasingactive', index: 'purchasingactive', editable: false, hidden: true },                 { name: 'hirnode', index: 'hirnode', editable: false, hidden: true },                 { name: 'finwor1', index: 'finwor1', editable: false, hidden: true },                 { name: 'finwor2', index: 'finwor2', editable: false, hidden: true },                 { name: 'finwor3', index: 'finwor3', editable: false, hidden: true },                 { name: 'finwor4', index: 'finwor4', editable: false, hidden: true },                 { name: 'finwor5', index: 'finwor5', editable: false, hidden: true },                 { name: 'finworp', index: 'finworp', editable: false, hidden: true },                 { name: 'healthcareactive', index: 'healthcareactive', editable: false, hidden: true }                 ],         pager: '#divwor',         jsonreader: {             root: "d.rows",             page: "d.page",             total: "d.total",             records: "d.records",             repeatitems: false         },         sortname: 'displayorder',         viewrecords: true,         sortorder: "asc",         onselectrow: function(displayorder) {             if (displayorder && displayorder !== lastsel) {                 jquery('#tblwor').jqgrid('restorerow', lastsel);                 jquery('#tblwor').jqgrid('editrow', displayorder, true);                 lastsel = displayorder;             }         },         cellsubmit: 'remote',         editurl: "default.aspx/editdata",         caption: "wor view grid"                });     jquery("#tblwor").jqgrid('navgrid', "#divwor", { edit: false, add: false, del: false }); } 

});

i able debug code. data being returned web method not being displayed in grid.

this data getting.. (i showing 1 row since data big)

 {"d":{"__type":"learneveryday._default+jqgridresult","total":1,"page":1,"records":25,"rows":[{"id":3,"cell":["3","2","jwo revenue"," 921,300 "," 899,595 "," 912,983 "," 941,659 "," 805,100 ","revenuejwo","false","false","false","0","","","","","",""," 4,480,637 "," 5,378,594 ","false",null]}} 

you need add serializerowdata callback in same way added serializegriddata. in same way need add ajaxrowoptions looks ajaxgridoptions. options defines option of $.ajax executed during editing of rows:

ajaxgridoptions: { contenttype: 'application/json; charset=utf-8' }, ajaxrowoptions: { contenttype: 'application/json; charset=utf-8' }, serializegriddata: function (postdata) {     return json.stringify(postdata); }, serializerowdata: function (postdata) {     return json.stringify(postdata); } 

you should remove unneeded second $(document).ready(function() handler registered inside of $(document).ready. mean code

jquery(document).ready(function($) {      var lastsel;      $(document).ready(function() {         loadgrid();     });      function loadgrid() {         jquery("#tblwor").jqgrid({             ...         });         jquery("#tblwor").jqgrid('navgrid', "#divwor", { edit: false, add: false, del: false });     } }); 

should replaced to

jquery(document).ready(function($) {     var lastsel;     $("#tblwor").jqgrid({         ...     }).jqgrid('navgrid', "#divwor", { edit: false, add: false, del: false }); }); 

i removed loadgrid function additionally, because function create grid. function called only once. sense define code in function if function called once?


Comments

Popular posts from this blog

python - cx_oracle unable to find Oracle Client -

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -