[Mono-bugs] [Bug 681553] New: FindControl not working as expected

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Mar 22 08:12:26 EDT 2011



           Summary: FindControl not working as expected
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.10.x
          Platform: x86-64
        OS/Version: openSUSE 11.4
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: debug
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: pavel.durchev at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

Created an attachment (id=420671)
 --> (http://bugzilla.novell.com/attachment.cgi?id=420671)
Project to show the bug

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.134 Safari/534.16

Hi All,
The problem is that FindControl doesn't search for the controls as expected.
What happens is that when you call FindControl in internal control (let's say
UserControl), the search for the control id is started form the page not from
the internal control. So if you have 2 labels with same ID (for example:
lblTest) - 1st inside the user control and 2nd inside the page itself, when you
call UserControl.FindControl("lblTest") it will return the instance inside the

If you override FindControl in your UserControl there is a possibility to enter
infinite loop. 

The attachment contains a project with some code copied from our real life
projects. It has 2 test cases which I think are related i.e. if the bug is
fixed for the first one it will be fixed for the other.

Congratulations for your good work on mono! Please keep it that way :)


Reproducible: Always

Steps to Reproduce:
Actual Results:  
Open attached project and click on the links

Expected Results:  
no exceptions

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list