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

Extract text from string
Hi folks,

I have a string that looks like this:

aaaaaaaaaa:
bbbbbbbbbb (ccccccccc)

insert/update functions for mysql, what do you think?
I am working on two really simple functions that automatically generate (and execute) insert and upd

Only add new information from XML to MySQL
What I am doing, is taking a xml file, and adding the values to a database. However, what I want to

Images outside webroot
Im hopeing someone can help me with this because i cant figure it out.I have setup an ASP.NET websit

Why doesn't this work? (SSH2)
This is my script:

Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);

What's wrong with my code
sobbing for many days, still don't know why please Help. Why my page isn't posted correctly. In a

BIG file upload!
Hey guys!

I'm trying to upload a file, it works well with smaller files but with 60mb+, I get

Dynamically allocating the number of rows in a table based on a variable value
Hi,
I have situation here which i cannot resolve, I have a variable temp which stores the num

Access database inside of a validation class
Hello,

For quite some time, I have been using functions to validate form input and access the

Hashing?
Hi, I was hoping to take a string value then convert it - consistently - across each of our pages in

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