473,513 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Native .NET Function to Bind to WebControl via ID String???

Is there a function I can use to bind to a web control on an ASP.NET 2.0 page
if I have a string for the ID of the control? I'd like to be able to throw
an ID string at a function and bind a control object to a textbox control
without having to loop through all the controls on the page.

For example (pseudo code), if I have a textbox with id="txtFirstName"...

Dim ctrlControlPlaceHolder as control
ctrlControlPlaceHolder = FindControlbylID("txtFirstName")
ctrlControlPlaceHolder.text = "Chris"

What I'm looking for is the "FindControlbyID(byVal ID as string)" function.
It's my assumption that there's a native function out there to do it. I
could probably write a function that does the control looping, but I'm going
to have a ton of controls on the page so a native function strikes me as much
more efficient and graceful.

Any help on this is greatly appreciated.

v/r

Chris Frohlich
Jun 28 '06 #1
1 1588
Doesn't the Page class have a FindControl method? I seem to remember it has
one, or maybe I am just having a "developer Senior Moment"?
Cheers,
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ChrisFrohlich" wrote:
Is there a function I can use to bind to a web control on an ASP.NET 2.0 page
if I have a string for the ID of the control? I'd like to be able to throw
an ID string at a function and bind a control object to a textbox control
without having to loop through all the controls on the page.

For example (pseudo code), if I have a textbox with id="txtFirstName"...

Dim ctrlControlPlaceHolder as control
ctrlControlPlaceHolder = FindControlbylID("txtFirstName")
ctrlControlPlaceHolder.text = "Chris"

What I'm looking for is the "FindControlbyID(byVal ID as string)" function.
It's my assumption that there's a native function out there to do it. I
could probably write a function that does the control looping, but I'm going
to have a ton of controls on the page so a native function strikes me as much
more efficient and graceful.

Any help on this is greatly appreciated.

v/r

Chris Frohlich

Jun 29 '06 #2

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

Similar topics

3
1442
by: spmm# | last post by:
Hi! Could someone please help me with the following; I have a WebControl that basically looks like this: public class LeftMenu : System.Web.UI.WebControls.WebControl { private string...
0
2011
by: Dariusz Tomon | last post by:
Hi I have got the problem with web control displaying flash (swf) object. The problem is connected with the fact that 1-st swf should loads the second one. But it doesn't. That's why I suspects...
3
3038
by: ryan.mitchley | last post by:
Hi all I have a class (cPort) that is designed to receive objects and, depending on the type, call a handler (callback) in any descendant of a cProcessBlock class. Callback functions take a...
1
6049
by: pnbaocuong | last post by:
Dear All When I try to use convert function of MS sql server like this: String sql = " (employee_id = '" + employee_id + "') and ((convert(VARCHAR,w_date,103) = '" + w_date + "'))"; ...
0
7260
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
7384
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
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7099
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...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5685
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.