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

problem with php server update from mid 2009
Hi,

I have this navigation menu on 2 websites which used to work just fine. After a recent up

script is pulling more then they have....
I have this script for my game where they can change there race. This will cost them 2,500 points. H

form submit at godaddy?
Trying to test form submission at GoDaddy and it does not seem to work. Here's the page...

h

$_POST
Hi, I have 2 seperate php files, and i want my $_POSt["fname"] To go into both of them, Fo

Which PHP-Editor do you think is the best?
Hi everyone,
Myself Brian Anderson. For the last 2 years i have been working a

Weird Problem with curl while sending data
I am facing a weird problem with sending data to a site via curl.

If i send the value by this

2 decima places & How to reload my page
Hello There,

How do i put full-stop (.) after second figure from behind? ie if i have 123456

Estimations and Effort
HI Gurus,

Would like to know whether SAP have a provision for carrying out the Project es

Code Help.. If txt input box empty search X instead..
I am having a problem with my search script. At current it will simply search by a selected date whi

Problem with umlauts and UTF-8
Hello every1,

I'm creating my own little CMS at the moment and got some problems with the cha

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