上代码://对象转换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"]));后台接收转成对象了但是还是编码的数据。求解
解决方案 »
- autocomplete控件问题
- 请问这样的字符在sqlserver中如何解开排序啊?
- 求一正则表达式
- .net做的网站上传到服务器,后台登录按钮为什么不响应?
- 封装DropDownList,怎么做?
- Caching with Server.Transfer()
- 关于DataSet的问题(javascript),请各位教下小弟
- System.Data.SqlClient.SqlDataReader
- 请大家介绍几本用asp.net设计的电子商务的书(最好是用C#后台编程)
- 在asp.net中为什么js的使用总是有问题?
- 在线播放器的问题。求高手帮助。
- 如何判断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;
}
如果是这样,你可以试试自定义序列化器
需要解码的字段解一下就好了