标题: asp datagrid 绑定数据 [打印本页] 作者: nazieagle 时间: 2014-7-6 10:14:55 标题: asp datagrid 绑定数据
为什么用文本文件绑定能绑定,一样的数据用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);