上代码://对象转换json格式
function _SealInfo() {
var obj = new Object();
obj.SAssessID = "-1";
obj.SUserID = "-1";
obj.DAddTime = "1900-01-01";
obj.SAssessName =escape(projectName);
obj.FCollectingArea = lab_fBuildArea;
obj.FPlanningArea = SumArea;
obj.SPlotRatio = escape(rjl);
obj.SConforming = escape(Conforming);
obj.SConformingID = escape(sConformingID);
obj.SProvince = escape(sProvince);
obj.SCity = escape(sCity);
obj.IParcelArea = CityCode;
obj.FAssessPrice_Market = fAssessPrice_Market;
obj.FTotalPrice_Market = fTotalPrice_Market;
obj.FAssessPrice_Assume = fAssessPrice_Assume;
obj.FTotalPrice_Assume = fTotalPrice_Assume; //判断
obj.IDistance_Markey = iDistance;
obj.ITimelimit_Markey = iTimelimit;
obj.IDistance_Assume = iDistance;
obj.ITimelimit_Assume = iTimelimit; obj.IItemCount_Markey = arr1.length;
obj.IItemCount_Assume = arr2.length;
//假设开发法参数
obj.FExpenseRatio = -1;
obj.FMargin =-1;
obj.FCosts = -1;
obj.FIncrease = -1;
obj.IState = State;
return $.toJSON(obj);
}
function UrlAjax(type) {
var infoJson = _SealInfo();
$.post("Agent/LandAssessDBdetail.ashx", { AssessAjaxtype: type, info: infoJson }, function(msg) {
})
后台ashxJavaScriptSerializer js =new JavaScriptSerializer();
LandAssess_BasicInfoClass info = js.Deserialize<LandAssess_BasicInfoClass>(context.Server.HtmlDecode(context.Request.Form["info"]));后台接收转成对象了但是还是编码的数据。求解
function _SealInfo() {
var obj = new Object();
obj.SAssessID = "-1";
obj.SUserID = "-1";
obj.DAddTime = "1900-01-01";
obj.SAssessName =escape(projectName);
obj.FCollectingArea = lab_fBuildArea;
obj.FPlanningArea = SumArea;
obj.SPlotRatio = escape(rjl);
obj.SConforming = escape(Conforming);
obj.SConformingID = escape(sConformingID);
obj.SProvince = escape(sProvince);
obj.SCity = escape(sCity);
obj.IParcelArea = CityCode;
obj.FAssessPrice_Market = fAssessPrice_Market;
obj.FTotalPrice_Market = fTotalPrice_Market;
obj.FAssessPrice_Assume = fAssessPrice_Assume;
obj.FTotalPrice_Assume = fTotalPrice_Assume; //判断
obj.IDistance_Markey = iDistance;
obj.ITimelimit_Markey = iTimelimit;
obj.IDistance_Assume = iDistance;
obj.ITimelimit_Assume = iTimelimit; obj.IItemCount_Markey = arr1.length;
obj.IItemCount_Assume = arr2.length;
//假设开发法参数
obj.FExpenseRatio = -1;
obj.FMargin =-1;
obj.FCosts = -1;
obj.FIncrease = -1;
obj.IState = State;
return $.toJSON(obj);
}
function UrlAjax(type) {
var infoJson = _SealInfo();
$.post("Agent/LandAssessDBdetail.ashx", { AssessAjaxtype: type, info: infoJson }, function(msg) {
})
后台ashxJavaScriptSerializer js =new JavaScriptSerializer();
LandAssess_BasicInfoClass info = js.Deserialize<LandAssess_BasicInfoClass>(context.Server.HtmlDecode(context.Request.Form["info"]));后台接收转成对象了但是还是编码的数据。求解
解决方案 »
- 关于Ajax拓展控件CascadingDropDown级联下拉控件的问题
- 关于网页中添加电子书
- silverLight 超链接跳转
- javascript如何同步调用webservice?
- 关于win7搭ASP服务器的问题
- 树控件增加了checkbox以后,是否可以做到,当选择了某个父节点的checkbox,子节点的checkbox也被选中?
- 关于将自定义实体类集合自动绑定到DataGrid上出现的问题!!
- 对象为空为什么If语句还会执行??
- 请问 “namespace如何保证?”这句话是什么意思
- 初学者的一个小问题;希望高手多多帮忙!
- 在线播放器的问题。求高手帮助。
- 如何判断Datalist嵌套checkbox其中checkbox全没选中的情况?
是何种用意呢?规避汉字乱码?
DataContractJsonSerializer outDs = new DataContractJsonSerializer(typeof(LandAssess_BasicInfoClass));
using (MemoryStream outMs = new MemoryStream(Encoding.UTF8.GetBytes(context.Request.Form["info"])))
{
LandAssess_BasicInfoClass info = outDs.ReadObject(outMs) as LandAssess_BasicInfoClass;
}
如果是这样,你可以试试自定义序列化器
需要解码的字段解一下就好了