日期:2014-05-17 浏览次数:20480 次
///webservice里面的一个方法,在jquery用ajax方法调用;
[WebMethod]
public List<Model.County> FindAll()
{
DAL.County county = new DAL.County();//DAL层代码我就不贴了,相信大家都懂
DataTable dt = county.FindAll();//查询数据库中的一张表有id,name,pId,open字段
List<Model.County> list = new List<Model.County>();
for (int i = 0; i < dt.Rows.Count; i++)
{
Model.County model = new Model.County()
{
id = Convert.ToInt32(dt.Rows[i]["id"]),
name = dt.Rows[i]["name"].ToString(),
pId = Convert.ToInt32(dt.Rows[i]["pid"]),
remark = dt.Rows[i]["remark"].ToString(),
open = "true"
};
list.Add(model);
}
return list;
}
function showIconForTree(treeId, treeNode) {
return !treeNode.isParent;
};
$(document).ready(function () {
var setting = {
view: {
showIcon: showIconForTree
},