您的位置:首页 > Web前端 > JavaScript

Model赋值返回json

2016-12-05 15:09 351 查看
DataTable resultList = bll.GetResultListByCondition(bureauCode, deptCode, fileTitle);

IList<GanBuTianChengTongZhiGuanLiResultViewModel> list = new List<GanBuTianChengTongZhiGuanLiResultViewModel>();

//遍历行对象

foreach (DataRow drEntry in resultList.Rows)

{

GanBuTianChengTongZhiGuanLiResultViewModel resultModel = new GanBuTianChengTongZhiGuanLiResultViewModel();

PropertyInfo[] propertys = resultModel.GetType().GetProperties();

foreach (PropertyInfo item in propertys)

{

item.SetValue(resultModel, drEntry[item.Name].ToString(), null);

}

list.Add(resultModel);

}

jsonResult = new JavaScriptSerializer().Serialize(list);

return jsonResult;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐