public IList<Category> Categories { get; set; }
PRotected void Page_Load(object sender, EventArgs e)
{
//这是静态给categories赋值,怎么动态赋值呢,就是连接数据库后查询数据绑定categories,使他的数据成下面一样显示
Categories = new List<Category>
{
new Category
{
Name = "category 1",
Children = new List<Category>
{
new Category
{
Name="category 1-1",
Children = new List<Category>{}
},
new Category
{
Name="category 1-2",
Children = new List<Category>{}
},
}
},
new Category{
Name ="category 2",
Children = new List<Category>{
new Category{
Name = "category 2-1",
Children = new List<Category>{}
},
new Category
{
Name = "category 2-2",
Children = new List<Category>{}
}
}
}
};
}
新闻热点
疑难解答