Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Must we use FindControl?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jordan S. - 22 May 2008 16:43 GMT
Is FindControl() really the *only* way to later get a reference to controls
that are dynamically added to a page?

I am currently using ParseControl to insert a bunch of controls into a
WebForm (which is itself dynamically inserted into the page).

In subsequent code I do in fact know the ID of one of the controls added
earlier via ParseControl. I would like to get a reference to that control
via it's ID (perhaps qualified by it's naming container) and not have to use
FindControl. But from all the googling I have done, it appears that my only
alternative is to use FindControl - which is expensive and, IMHO unnecessary
given that I already know the naming container in which the control exists.

Do I have any alternatives to FindControl() ?

Thanks.
bruce barker - 22 May 2008 17:19 GMT
no. you could save a reference to the control when you create it. if you
don't do this then findcontrol is you only option. it just loops thru the
naming container controls collection looking for a control with the specified
id.

-- bruce (sqlwork.com)

> Is FindControl() really the *only* way to later get a reference to controls
> that are dynamically added to a page?
[quoted text clipped - 12 lines]
>
> Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.