public static string GetDataList(int PageIndex, int PageSize) { try { int intRecordCount = 0; List <object> listReturn = new List <object>(); BLL_CustomizeHtml bll = new BLL_CustomizeHtml(); DataTable dt = bll.GetListByPage("", "CreateTime desc", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0]; intRecordCount = bll.GetRecordCount(""); foreach (DataRow item in dt.Rows) { listReturn.Add(new { CustomizeHtml_Id = item["CustomizeHtml_Id"].ToString(), HtmlType = item["HtmlType"].ToString(), HtmlContent = pfunction.GetSubstring(pfunction.DeleteHTML(item["HtmlContent"].ToString()), 200, true), CreateTime = pfunction.ConvertToLongDateTime(item["CreateTime"].ToString()) }); } if (dt.Rows.Count > 0) { return(JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = intRecordCount, list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = "error" })); } }