1.in client page:
even data is stored in model,but since we use the 「Ext.JSON.encode」,have to trim
before we send ,for example:
===============================================
var arrSubmit = new Array();
for (var i = 0; i < gridSelected.getStore().getCount() ; i++) {
var rec = gridSelected.getStore().getAt(i);
var rec2Send = {
COS_CODE: rec.get('COS_CODE'),
COS_NAME: rec.get('COS_NAME'),
SBJ_CODE: rec.get('SBJ_CODE'),
SBJ_NAME: rec.get('SBJ_NAME'),
GRP_CODE: rec.get('GRP_CODE'),
GRP_NAME: rec.get('GRP_NAME'),
GRP_DTL: rec.get('GRP_DTL'),
TTL_SLOT: rec.get('TTL_SLOT'),
SELECTED: rec.get('SELECTED')
};
arrSubmit.push(rec2Send);
==============in the ajax request function==============
Ext.Ajax.request({
url: "......your url to handle the request....",
method: 'POST',
params: {
dateString: timeStamp,
recsInString:
Ext.JSON.encode(arrSubmit).replace(/<br\/>/g,"\\n")
},
success: function (response) {
alert("Error: " - response.responseText);
},
failure: function (response) {
alert("Error: " - response.responseText);
}
});
================at server side,how it receive===========================
public JsonResult RcvPreRegSubjGrp(string dateString,string recsInString) {
List<MdlCosSbjGrpDtl>
recs = JsonConvert.DeserializeObject<List<MdlCosSbjGrpDtl>>(recsInString);
for (int i = 0; i < recs.Count ;i++ )
{
util.SqlLog.writeLog(dateString+" recieved pre-reg data is ",
recs[i].toLogString()
);
}
....
.....
....
======================================================
以上