473,385 Members | 1,930 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,385 software developers and data experts.

Page.FindControl not working on ASCX

If I call Page.FindControl() on an aspx, it finds the control, but if I call
it on an ASCX, it does not. Why not?

And how would I call it?


Nov 18 '05 #1
1 12028
Depends where the control is you are trying to find...

If you are trying to find a control in the parent page, you would use
Parent.Page.FindControl("controlID");

If you are trying to find a control within the user control's own control
collection then you would use
this.FindControl("controlID");

Not quite sure what Page.FindControl does when called from within a
UserControl but it never seems to be of any use as it always returns null.
Use the above methods and you should find the control you're looking for.

Matt
http://www.3internet.co.uk

"Michael Murschell" <mm********@gonelco.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
If I call Page.FindControl() on an aspx, it finds the control, but if I call it on an ASCX, it does not. Why not?

And how would I call it?

Nov 18 '05 #2

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

Similar topics

4
by: Buzzy | last post by:
Hi all, I'm trying to use this : <html> <head> <style type="text/css"> @page { margin:10cm } </style> </head>
0
by: dh | last post by:
As a simple example, I can't seem to be able to reference a label called "lblOutput" that exists in my test.aspx page from within a User control, TestControl.ascx. I am stumped. Any help is...
2
by: sri_san | last post by:
Hello, I have a bunch of controls with unique IDs as below: <INPUT VALUE='1' id=chkbox1-1 NAME=CheckBox1 TYPE=Radio runat=server> these HTML controls r wrapped in a plain table. When I do a...
2
by: Martin Eyles | last post by:
Hi, I am using Page.FindControl in a loop to select some numbered tags aTag = Page.FindControl("Tick_" + CStr(aNumber)) however, when I come to add a style to this ...
0
by: Michael Murschell | last post by:
If I call Page.FindControl() on an aspx, it finds the control, but if I call it on an ASCX, it does not. Why not? And how would I call it?
1
by: dm1608 | last post by:
I have an ASP.NET 2.0 application that is giving me exception errors when particular queries are run. Running webpage locally, I can see the stack trace of the error. Running remotely, I get the...
0
by: tshad | last post by:
I have a .ascx file that I converted to a class. But I am getting the following error: error BC30469: Reference to a non-shared member requires an object reference. The error is for the...
3
by: tshad | last post by:
I have a .ascx file that I converted to a class. But I am getting the following error: error BC30469: Reference to a non-shared member requires an object reference. The error is for the...
4
by: Rob Meade | last post by:
Hi all, I was wondering if you can help. I have the need to find a control on the page for which I don't know all of the ID, this is because it is made up from several id's forming one new id. ...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.