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

Strange PHP/mySQL error ... am I just tired?
Code: <?

## CONNECT TO DB FUNCTION!
function ConnectTo($db2con)
{
$hostNam

Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit

How could I combine these arrays??
Hello.. I'm trying to figure out a way to combine these first two arrays to get the last array..

! = ''
In the following 'IF' statement if v_ompcat = PU for example then Oracle equates that 'IF' statement

tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e

Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:

Can a php script be

Transport data between itab and textfield on ALV event
Hallo,

I have a ALV Grid ( cl_gui_alv_grid ) and I also have hotspot click event with a h

[function.file]: failed to open stream: No such file or directory
Okay I wrote this little script to upload a csv file that is located on my webhosts server to a mysq

how to get values from $_Post with onchange="form.submit();"?
Hi, I have a form that submit to itself with a file upload field and two other hidden field values.<

Developing Ajax-enabled ASP.Net applications for the iPhone
I would like to develop Ajax web applications using Visual Studio that are optimized for the iPhone.

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