zoukankan
html css js c++ java
C#递归在dropdownlist显示树状
/**/
/**/
/**/
///
<summary>
///
绑定文件分类
///
</summary>
public
void
bind()
{
//
获取数据集
DataSet ds
=
new
DataSet();
ds
=
ec.ExecuteSelectCmmond(
"
select * from t_Column where U_UserID='
"
+
HttpContext.Current.Request.Cookies[
"
NameID
"
].Value
+
"
'
"
, ds);
BindingCWAList(DropDownList1, ds);
}
private
void
BindingCWAList(DropDownList ddlID, DataSet ds)
//
ddlID是DropDownList控件的ID
{
DropDownList1.Items.Clear();
//
此处创建顶极分类,Value=0(如不需要,可以删除此行)
ddlID.Items.Add(
new
ListItem(
"
请选择目录
"
,
"
0
"
));
InitList(ddlID,
0
, ds,
""
);
}
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
+
"
……
"
);
}
}
查看全文
相关阅读:
ActiveMQ-在Centos7下安装和安全配置
Servlet基础知识点
Filter的执行顺序
Dubbo-使用Maven构建Dubbo服务的可执行jar包
Dubbo-Centos7管控台安装
Spring 小知识点
Zookeeper+ActiveMQ集群搭建
Zookeeper在Centos7上搭建单节点应用
SpringMVC+AJAX+JSON
RocketMQ-Filer
原文地址:https://www.cnblogs.com/craig/p/1238317.html
最新文章
Linux设备模型(3)_Uevent
Ubuntu防火墙设置
cryptkeeper的使用
低功耗蓝牙BLE之连接事件、连接参数和更新方法
Linux USB Project
Overview and Evaluation of Bluetooth Low Energy: An Emerging Low-Power Wireless Technology
Generic Access Profile
Linux下pipe使用注意事项
Linux性能分析工具的安装和使用
Android Message Handling Mechanism
热门文章
接口入参保护的含义
mapping4java源码下载(alibab的开源项目)
path、classpath理解
阿里数据库连接池druid
java面试题
xml中${}的使用含义(美元符号大括号,以Spring、ibatis、mybatis为例)
left join后面加上where条件浅析
An error occurred at line: 1 in the generated java file问题处理
CXF报错[1 counts of IllegalAnnotationExceptions]and[Two classes have the same XML type name]and[Use @XmlType.name and @XmlType.namespace to assign different names to them]
Logback初始化失败问题排查(Web.xml中context-param配置详解)
Copyright © 2011-2022 走看看