Solution to the FindControl problem


Posted on 16th Feb 2014 07:03 pm by admin

I have seen may posts about having problems with the FindControl method. Most seem to come about because the control being searched for is nested within a container other than the webform.I came across this code (sorry dont remember the web site) that I have posted in response to many of the posts related to this type of problem. I thought it would be easier if I post this code here for others to find./// /// Finds a Control recursively. Note finds the first match that exists /// /// Should be the lowest container in the heirarchy, for eg dont choose Master page if you can pick the specific panel /// ID of the control you are looking for /// the control if found else null private static Control FindControlRecursive(Control Root, string Id) {if (Root.ID == Id) return Root; foreach (Control Ctl in Root.Controls) {Control FoundCtl = FindControlRecursive(Ctl, Id); if (FoundCtl != null) return FoundCtl; }return null; }

No comments posted yet

Your Answer:

Login to answer
148 Like 21 Dislike
Previous forums Next forums
Other forums

I need help with formatting date from mysql! with php!
Hello guys

*Note: this is a php question not MySQL question, please do not move it to mysql s

Check something, wait, check again, do something!
Hi guys.

I wonder if someone can help me with this.

Basically, what I want to do is (

When i am Canseling the Billing Document in VF11 I am getting Shortdump
Hi Experts

When i am Canseling the Billing Document in VF11 I am getting Shortdump.

parameter passing issue on function
Well I thought I had created a pretty slick web page, using ?page and $_GET to load pages which wher

remove innitial

and

tags
i am using tiny_mce as a text editor for my CMS.
buy now the problem is it add <p>

Web Host List
Here is a list of web hosts that offer PHP and MySQL. It is no where near a full list, but it is mos

header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1

Check Digits and extracting digits
I think I can figure out the code for this but I am having a very hard time getting past the first s

ScriptManager History and Opera Issue
I am having an issue in opera with the ScriptManager. I have a ScriptManager on a page with history

SAP FICO learning materials
Hi all,
I am new to this world of SAP FICO. I have taken training on SAP FICO, but was wonderin

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash