html - Looping through labels of a div -
html - Looping through labels of a div -
i have div tag id set run @ server can accessed code behind in asp.net.
<div id="mytst" runat="server"> <asp:label id="lbl1" text="hello" runat="server" /> <asp:label id="lbl2" text="world" runat="server" /> </div>
i trying load command , loop through it, finding of label kid controls of div , reading text values. wondered if knew of approach doing this.
in code behind doing like...
dim myplaceholder contentplaceholder = directcast(master.findcontrol("contentplaceholder1"), contentplaceholder) dim cntrldiv htmlcontrol = directcast(myplaceholder.findcontrol("mytst"), htmlcontrol)
it sounds need this.
''' <summary> ''' returns recursive list of controls within current control. ''' </summary> ''' <param name="control">the control.</param> ''' <returns></returns> <extension()> _ public function recursivecontrollist(byval command control) generic.list(of control) dim lst new generic.list(of control) homecoming dorecursivecontrollist(control, lst) end function private function dorecursivecontrollist(byval command control, byval currentlist generic.list(of control)) generic.list(of control) if not command nil each kid command in control.controls() currentlist.add(child) dorecursivecontrollist(child, currentlist) next end if homecoming currentlist end function
html asp.net vb.net
Comments
Post a Comment