请教ASP.NET中的TreeView控件的样式以及搜索命中问题

来源:百度知道 编辑:UC知道 时间:2024/09/25 15:19:27
在TreeView中,我如何设置1级2级3级的样式?
让他使用UL来布局,而不是用Table?

在搜索的时候,比如我搜索的内容是TreeView中的第二个子项中的第三个子叶,在我搜索转向到该页面时如何默认打开呢? 内容可以根据ID来判断,但是分类列表应该如何判断是哪个子分类呢?
我的要求并不是根据URL自动判断节点,而是这个分类列表是统一页面,只不过是URL上的ID不同而已。
比如分类列表

/// <summary>
/// 动态读取数据库生成一个Tree导航
/// </summary>
public void Tree1()
{
TreeNode root = new TreeNode("书籍分类", "0", "", "Main/#", "");

IList<Categorie> list_cat = CategorieManager.GetAllCategories();
foreach (Categorie cat in list_cat)
{
TreeNode tree1 = new TreeNode(cat.Name, cat.Id.ToString(), "", "~/Main/Index.aspx?CategoryId=" + cat.Id.ToString(), "");
root.ChildNodes.Add(tree1);
}
this.tvDaoHang.Nodes.Add(root);
}