- 注册时间
- 2014-7-6
- 最后登录
- 2014-7-6
- 阅读权限
- 10
- 积分
- 5
- 精华
- 0
- 帖子
- 1
|
为什么用文本文件绑定能绑定,一样的数据用aspx就不行?
后台代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
namespace WebApplication1.aspx
{
public partial class WebFormShowManagerJson : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
{
List<Manager> list = ModelList.GetManagerList();
Manager admin = new Manager
{
AutoId = 1,
Id = "M001",
Name = "admin",
Password = "123",
DataManage = "有",
SaleManage = "有",
CustomerManage = "有",
AccountManage = "有",
PersonnelManage = "有"
};
list.Add(admin);
JavaScriptSerializer serializer = new JavaScriptSerializer();
var obj = new
{
total = list.Count,
data = list
};
string json = serializer.Serialize(obj);
Response.Write(json);
}
}
}
}
|
|