C#递归在dropdownlist显示树状
2008-07-08 16:42
441 查看
public void bind()
private void BindingCWAList(DropDownList ddlID, DataSet ds) //ddlID是DropDownList控件的ID
private void InitList(DropDownList ddlID, int parentID, DataSet catagoryDS, string indent)
{
//Select后边的是DataSet里面的列名
System.Data.DataRow[] currRows = catagoryDS.Tables[0].Select("ColumnFatherld=" + parentID.ToString(), "ColumnFatherld ASC");
int count = currRows.Length;
DataRow catagoryRow;
for (int i = 0; i < count; i++)
{
catagoryRow = currRows[i];
System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem(indent + catagoryRow["ColunmnName"].ToString(), catagoryRow["ColumnId"].ToString());
ddlID.Items.Add(item);
InitList(ddlID, Int32.Parse(catagoryRow["ColumnId"].ToString()), catagoryDS, indent + "……");
}
}
private void BindingCWAList(DropDownList ddlID, DataSet ds) //ddlID是DropDownList控件的ID
private void InitList(DropDownList ddlID, int parentID, DataSet catagoryDS, string indent)
{
//Select后边的是DataSet里面的列名
System.Data.DataRow[] currRows = catagoryDS.Tables[0].Select("ColumnFatherld=" + parentID.ToString(), "ColumnFatherld ASC");
int count = currRows.Length;
DataRow catagoryRow;
for (int i = 0; i < count; i++)
{
catagoryRow = currRows[i];
System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem(indent + catagoryRow["ColunmnName"].ToString(), catagoryRow["ColumnId"].ToString());
ddlID.Items.Add(item);
InitList(ddlID, Int32.Parse(catagoryRow["ColumnId"].ToString()), catagoryDS, indent + "……");
}
}
相关文章推荐
- C#递归在dropdownlist显示树状(转)
- 用递归在Dropdownlist中显示树状结构(连数据库)
- 用递归在Dropdownlist中显示树状结构(连数据库)
- 用递归在Dropdownlist中显示树状结构
- 通过递归方法 将DataTable中的树状数据信息 按树状格式显示在DropDownList中
- 用递归在Dropdownlist中显示树状结构
- 递归在Dropdownlist中显示树状结构
- 通过递归方法 将DataTable中的树状数据信息 按树状格式显示在DropDownList中
- C# 递归显示 TreeView 树状菜单树!
- DropDownList 无限级分类 树状显示 (递归)
- 用递归在Dropdownlist中显示树状结构
- (asp.net c#)DropDownList绑定后显示对应的项的两种方法
- C#使用Jquery zTree实现树状结构显示_异步数据加载
- 树状结构显示之递归练习并说明写递归代码的技巧
- ASP 递归显示无穷树状结构, 下拉框中显示树状效果
- C#使用Jquery zTree实现树状结构显示 异步数据加载
- C#递归绑定显示带图标TreeView
- 用树状结构显示BBS的帖子及其回帖,使用递归方法.
- 用递归实现文件目录树状显示