生成EasyUI treegrid json 的一种方法

时间:13-04-07 栏目:EasyUI, LINQ, Net 作者:zongyan86 评论:0 点击: 7,352 次

int count2 = mBLL.GetPageCount("Module", "", 1);
ds = mBLL.GetPageInfo("*", "Module", "", "ModuleId", "desc", 1,count2 , 1);
entities = mBLL.GetRowEntity(ds);

var n1 = entities.Where(q => q.ParentId == id.Default(0)).Select(s =>
new
{
id = s.ModuleId
,
text = s.ModuleName
,
state = entities.Any(y => y.ParentId == s.ModuleId) ? "closed" : null
,
ActionHtml = ActionHtml(s.ModuleId)
}
).OrderBy(o => o.id);

context.Response.Write(JsonConverter.Parse(n1));

 

public string ActionHtml(int id)
{
DataSet dss = new DataSet();
ModuleAction maBll = new ModuleAction();
string strHtml = "";
int count3 = maBll.GetPageCount("ModuleAction", "", 1);
dss = maBll.GetPageInfo("*", "ModuleAction", "and ModuleId='" + id + "'", "ActionId", "desc", 1, count3, 1);
for (int j = 0; j < dss.Tables[0].Rows.Count; j++)
{
strHtml += " <input type=checkbox m=" + dss.Tables[0].Rows[j]["ModuleId"].ToString() + " a=" + dss.Tables[0].Rows[j]["ActionId"].ToString() + " chkType=Action " + (dss.Tables[0].Rows[j]["IsDef"].ToString() == "1" ? "checked=true" : "") + " /> " + dss.Tables[0].Rows[j]["ActionName"].ToString();
}
return strHtml;
}

web技术分享



声明: 本文由( zongyan86 )原创编译,转载请保留链接: 生成EasyUI treegrid json 的一种方法

关注我们