代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Asp.Net
】
DropDownList手动构造一个下拉树形
作者:
CSDN
/ 发布于
2012/1/11
/
1073
<div><span style="color: rgb(0,0,255)">private</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">void</span><span style="color: rgb(0,0,0)"> bindDDL(DropDownList DDL, DataSet ds, </span><span style="color: rgb(0,0,255)">int</span><span style="color: rgb(0,0,0)"> ParentID, </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> Tab) { DataView dv </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">new</span><span style="color: rgb(0,0,0)"> DataView(ds.Tables[</span><span style="color: rgb(128,0,128)">0</span><span style="color: rgb(0,0,0)">]); dv.RowFilter </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">ParentId=</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> ParentID.ToString(); </span><span style="color: rgb(0,0,255)">int</span><span style="color: rgb(0,0,0)"> count </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,128)">0</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">foreach</span><span style="color: rgb(0,0,0)"> (DataRowView Row </span><span style="color: rgb(0,0,255)">in</span><span style="color: rgb(0,0,0)"> dv) { count</span><span style="color: rgb(0,0,0)">++</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (Tab.IndexOf(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">├</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">) </span><span style="color: rgb(0,0,0)">></span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(128,0,128)">1</span><span style="color: rgb(0,0,0)">) { Tab </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Tab.Replace(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">├</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">│</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); } </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (Tab.IndexOf(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">└</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">) </span><span style="color: rgb(0,0,0)">></span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(128,0,128)">1</span><span style="color: rgb(0,0,0)">) { Tab </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Tab.Replace(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">└</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); } </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (dv.Count </span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,0)"> count) { Tab </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Tab </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">└</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> { Tab </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Tab </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">├</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } dropMenuML.Items.Add(</span><span style="color: rgb(0,0,255)">new</span><span style="color: rgb(0,0,0)"> ListItem(Tab </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> Row[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">MenuName</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">].ToString(), Row[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">ID</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">].ToString())); bindDDL(dropMenuML, ds, Convert.ToInt32(Row[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">ID</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">].ToString()), Tab); Tab </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Tab.Remove(Tab.Length </span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,128)">1</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,128)">1</span><span style="color: rgb(0,0,0)">); } </span><span style="color: rgb(0,0,255)">private</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">void</span><span style="color: rgb(0,0,0)"> ShowData() { </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.dropMenuML.DataTextField </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">MenuName</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.dropMenuML.DataValueField </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">ID</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; MenuBll bll</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">new</span><span style="color: rgb(0,0,0)"> MenuBll(); DataSet ds </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> bll.GetList(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">MenuName,ID,ParentId,Url</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">MenuManage</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">""</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">GetList就是一个查询列表select * from MenuManage;</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> bindDDL(dropMenuML, ds, </span><span style="color: rgb(128,0,128)">0</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">""</span><span style="color: rgb(0,0,0)">); dropMenuML.Items.Add(</span><span style="color: rgb(0,0,255)">new</span><span style="color: rgb(0,0,0)"> ListItem(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">----Please Choose----</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">0</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)); dropMenuML.SelectedIndex </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> dropMenuML.Items.Count </span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,128)">1</span><span style="color: rgb(0,0,0)">; } </span></div>
试试其它关键字
同语言下
.
gzip压缩
.
实现http多线程断点续传下载文件
.
实现多线程断点续传下载大文件
.
生成字符串的 CheckSum
.
根据 UserAgent 获取浏览器的类型和版本
.
根据 Agent 判断是否是智能手机
.
隐藏手机号中间四位为*方法
.
合并图片(二维码和其他图片合并)
.
ASP.NET CORE中判断是否移动端打开网页
.
ASP.NET(C#)实现页面计时(定时)自动跳转
可能有用的
.
gzip压缩
.
实现http多线程断点续传下载文件
.
实现多线程断点续传下载大文件
.
生成字符串的 CheckSum
.
根据 UserAgent 获取浏览器的类型和版本
.
根据 Agent 判断是否是智能手机
.
隐藏手机号中间四位为*方法
.
合并图片(二维码和其他图片合并)
.
ASP.NET CORE中判断是否移动端打开网页
.
ASP.NET(C#)实现页面计时(定时)自动跳转
CSDN
贡献的其它代码
(
27
)
.
xml操作类
.
完全无组件,不用调用Excel.exe 导出数据到Excel
.
DropDownList手动构造一个下拉树形
.
判断是否低于IE6的版本
.
javascript 鼠标拖拉画图
.
取汉字首字母
.
字符串格式化通用类
.
mssql海量高效分页存储过程
.
.net 获取远程IP 得到省市
.
javascript 模仿windows拖动 封装类
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3