Binding the drop box of the tree structure

xiaoxiao2021-03-06  36

Function

#Region "drop-down frame tree bind" private function DDLBIND (Byval DDL AS DROPDOWNLIST, BYVAL DT AS DATATABLE) DIM FATHERID AS STRING IF DT.ROWS.COUNT = 0 THEN EXIT FUNCTION DIM I as INTEGER = DT.ROWS.COUNT - 1 me.textbox1.text = me.textbox1.text 1 Dim n as integer = me.textbox1.text Dim J AS Integer While I 1> 0 if Isdbnull (Dt.Rows (i) .Item ("DC_Parent_ID") ) THEN FATHERID = "" Else FatherId = dt.rows (i) .Item ("DC_PARENT_ID") End IF

DIM STRPADING As String = "" "

If DDL.Items (n) .Value = Fatherid Then for j = 0 to n strpading = "" "" NEXT

Dim Rslist as new listitem rslist.text = strpading & "├" & dt.rows (i) .Item ("dc_name") rslist.value = dt.rows (i) .Item ("DC_ID") DDL.Items.add (RSLIST)

Dt.ROWS (i) .delete () Dt.acceptchanges ()

DDLBIND (DDL, DT)

i = dt.rows.count end if i = i - 1 end while end function # End Region

2. Application

1) Place a TextBox control on the page, id = "textbox1", text = -1

2) Direct call function

转载请注明原文地址:https://www.9cbs.com/read-60218.html

New Post(0)