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

Ajax结合Js操作灵活操作表格

2014-09-26 15:30 211 查看
Table页面:

<%@ WebHandler Language="C#" Class="LoadAllLogInfo" %>

using System;
using System.Web;
using System.Data;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using EFDataEntities;
using EFDemoLite.Data.Infrastructure;
using EFDemoLite.Data.Repositories;

public class LoadAllLogInfo : IHttpHandler
{
public IPM_LogUploadInfoRepository logRep = new PM_LogUploadInfoRepository(DatabaseFactory.GetFactory());
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
var list = logRep.GetAll().ToList();
var recList = new List<LogPathModel>();
foreach (var item in list)
{
recList.Add(new LogPathModel {
Lid=item.LID,
Path=item.LogPath,
PType=item.LogPathType=="0"?"絕對路徑":"相對路徑"
});
}
System.Web.Script.Serialization.JavaScriptSerializer
js = new System.Web.Script.Serialization.JavaScriptSerializer();
string jsonStr = js.Serialize(recList);
context.Response.Write(jsonStr);
}
class LogPathModel
{
public string Lid { get; set; }
public string Path { get; set; }
public string PType { get; set; }
}
public bool IsReusable
{
get
{
return false;
}
}

}


其他的ashx可参照此例
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: