asp.net - Iterate each textbox controls in "MainContents"? -


i'm able iterate each text box control in "maincontents" using code below. q1: there shorter way? (to controls in "maincontents"?)

    each ctrl control in page.controls         each subctrl control in ctrl.controls             each subctrlsub control in subctrl.controls                 if typeof subctrlsub system.web.ui.webcontrols.contentplaceholder                     if subctrlsub.clientid = "maincontent"                         each ct control in subctrlsub.controls                             if typeof ct system.web.ui.webcontrols.textbox                                 r short = 1 8                                     c short = 1 6                                         .... (do something) ...                                     next                                 next                             end if                         next                     end if                 end if             next         next     next 

i converted c# vb, forgive potential incorrectness. called recursion.

protected sub dosomething(ctrl control)    each c control in ctrl.controls        if typeof c contentplaceholder           if c.clientid = "maincontent"                            // stuff           end if        end if         if c.controls.count > 0           dosomething(c)        end if    next end sub 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -