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
+
"
……
"
);
}
}
查看全文
相关阅读:
python笔记1
git笔记
手撸一个简陋直播系统
spring-boot学习笔记1
设计模式1--简单工厂模式
网联:第一章:浏览器生成消息
php线上预览日志--4.websocket客户端
php线上预览日志--3.websocket服务部署
php线上预览日志--2.谷歌插件开发
php线上预览日志--1.概述
原文地址:https://www.cnblogs.com/craig/p/1238317.html
最新文章
Java复习_static静态属性(类属性)
Java复习_数组Arrays方法
Java复习_面向对象基本使用
Java复习_switch使用
Java复习_函数使用
2018卷_26_将字符串1中去掉数字后的其他字符放到字符串2中,并打印。
战争雷霆数值设计思考
睡眠习惯
ubuntu下nodejs的升级问题
docker文档笔记
热门文章
一台linux通过另一台linux访问互联网
/boot is 100% full ubuntu
python中对minio的使用
xml.parsers.expat.expaterror syntax error line 1 column 0
database中不存在的数据的概率怎么求(smoothing)?
利用本地浏览器远程服务器上的jupyter notebook(报错/usr/bin/python3: No module named ipykernel_launcher)
LSTM神经网络输入输出究竟是怎样的?
词向量
ADB android debug monitor里面查找不到andoird设备的解决办法
解决TFS无法添加文件夹
Copyright © 2011-2022 走看看