Foreground page time Format modified:
@item. Createtime.tostring ("yyyy-mm-dd hh:mm:ss")
Foreground method call Pass parameter:
<a href="#" title=" edit " onclick= " Openprintmode (' edit ', ' @item. KeyId '); "> Edit </a>
The method of the foreground controller in the asynchronous tuning:
varSaveData =function () {varPostData ={printerkeyid: $ ("#hid_printkeyId"). Val (), Supplierkeyid: $ ("#hid_suppierkeyId"). Val (), printertype:$ ("#printType"). Val (), PrinterName: $ ("#printName"). Val (), Printercode: $ ("#printCode"). Val ()}; Console.log (PostData); $.ajax ({URL:'/supplier/addprinter', type:'POST', Data:postdata, Success:function (res) {if(Res.flag) {Search (1); }Else{alert (res.msg); } } }); }
See the Controller in the method: This is an entity, and there are 5 parameters in the entity, respectively,
Printerkeyid, Supplierkeyid, Printertype, PrinterName, Printercode.
[HttpPost] PublicJsonresult AddPrinter (Supplierprinteraddrst request) {Try{request. Requestvpiaouserkeyid=Userhelper.currentuserid; SUPPLIERPRINTERADDRSP Response= Wcfinvoke.invoke (v =V.supplierprinteradd (Request)); if(Response. Result.responsecode = =0) { returnJson (New{flag =true, msg ="saved successfully" }); } Else { //responsecode==1 encoding or name duplication returnJson (New{flag=false, msg=Response. Result.errormessage}); } } Catch(Exception ex) {Loghelper.error ("Save Printer List exception, execute Suppliercontroller.addprinter=>supplierprinteradd exception", ex); returnJson (New{flag =false, msg =Ex. Message}); } }
The reception in MVC