datagrid| sample
Often on the csdn to see a netizen asked how to achieve repeater,datalist, the datagrid nesting problem, the following gives a 3-layer nested example, can be nested indefinitely
Private Intfirst as Integer
Private Intsecond as Integer
Private Sub Page_Load (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles MyBase.Load
' Put user code to initialize the page
Dim Al as New ArrayList
Al. ADD (0)
Al. ADD (1)
Rpt_catalog. DataSource = Al
Rpt_catalog. DataBind ()
End Sub
Sub Rpt_catalog_onitemdatabound (ByVal sender as Object, ByVal e as RepeaterItemEventArgs)
Dim rpt as Repeater
rpt = E.item.findcontrol ("Rpt_board")
Intfirst = E.item.itemindex
Dim Al as New ArrayList
Al. ADD (Intfirst & ". 0")
Al. ADD (Intfirst & ". 1")
Rpt. DataSource = Al
Rpt. DataBind ()
End Sub
Sub Rpt_board_onitemdatabound (ByVal sender as Object, ByVal e as RepeaterItemEventArgs)
Dim rpt as Repeater
rpt = E.item.findcontrol ("Rpt_boardmaster")
Intsecond = E.item.itemindex
Dim Al as New ArrayList
Al. ADD (Intfirst & "." & Intsecond & ". 0")
Al. ADD (Intfirst & "." & Intsecond & ". 1")
Rpt. DataSource = Al
Rpt. DataBind ()
End Sub
The code has been tested, but please optimize it yourself
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.