45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:DropDownList的树形结构的详细介绍

DropDownList的树形结构的详细介绍

2016-08-29 17:53:08 来源:www.45fan.com 【

DropDownList的树形结构的详细介绍

Sub bind_DDL()
Dim dtb As DataTable = New DataTable("test")
Dim myDataColumn As New DataColumn
Dim drow As DataRow
Dim i As Int32
myDataColumn.DataType = System.Type.GetType("System.String")
myDataColumn.ColumnName = "c1"
dtb.Columns.Add(myDataColumn)
drow = dtb.NewRow()
drow("c1") = "ItemA"
dtb.Rows.Add(drow)
For i = 0 To 2
drow = dtb.NewRow()
drow("c1") = Server.HtmlDecode("  ") + "ItemA" + i.ToString()
dtb.Rows.Add(drow)
Next
drow = dtb.NewRow()
drow("c1") = "ItemB"
dtb.Rows.Add(drow)
For i = 0 To 2
drow = dtb.NewRow()
drow("c1") = Server.HtmlDecode("  ") + "ItemB" + i.ToString()
dtb.Rows.Add(drow)
Next
DropDownList1.DataSource = dtb
DropDownList1.DataTextField = "c1"
DropDownList1.DataValueField = "c1"
DropDownList1.DataBind()
End Sub
 

本文地址:http://www.45fan.com/a/question/69444.html
Tags: 原创 DropDownList 树形
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部