473,388 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Must we use FindControl?

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.

Jun 27 '08 #1
1 1436
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)
"Jordan S." wrote:
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.

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: James G. Beldock | last post by:
I have seen the following behavior: when issuing a Page.FindControl() for a control which exists in an item template (from within an ItemDataBound() event, for example), I get nulls back...
1
by: Tim::.. | last post by:
Hi can someone please help me with the following error! I keep getting: ERROR: System.InvalidCastException: Object must implement IConvertible. Line 231: PageID =...
1
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error! I can't seem to find out what is causeing the problem and would really appritiate any assistance! Thanks! ... ERROR ...
7
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim...
2
by: christof | last post by:
How to do it: My page: <asp:DataList ID="dataListRoleMembers" ...> .... <FooterTemplate> <asp:LinkButton ID="btnAddMember" runat="server"...
0
by: =?Utf-8?B?Qm9i?= | last post by:
I have a GridView control in page called which is inheriting from a MasterPage. The normal code to export to GridView does not work and gives me an error - "Control of type GridView must be placed...
7
by: AAaron123 | last post by:
Me.FindControl("MissionScheduleID"), below returns null. Do you know what I'm doing wrong? Thanks ***In my .aspx file I have: asp:Content ID="Content3"...
4
by: Hillbilly | last post by:
Maybe this is or isn't some kind of bug but it sure is goofy and remains a mystery that really has me puzzled for two reasons... // goofy syntax functions as expected... Panel finalStepButton =...
9
by: AAaron123 | last post by:
I'm this far in determining the correct code to find a textbox I need to set. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.