473,396 Members | 2,018 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,396 software developers and data experts.

Get the UserControl on which a Control resides?

I have a custom validation control I have created. One of the actions it
performs is similar to the CustomValidator in that I specify a function to
run, and it goes and runs the function. Previously I had been doing this
with the line:

this.VerifyValidate +=
(VerifyValidateDelegate)Delegate.CreateDelegate(ty peof(VerifyValidateDelegat
e), this.Page, m_CustomFunction);

This has worked fine as long as the control resided on an ASPX page. Today I
tried using the control for the first time on an ASCX page that I made, and
found out that it won't work. I have figured out that the problem is that
with this.Page specified, the CreateDelegate function is looking for the
function I specified on the ASPX page, when I really need it to find the
function on the ASCX page.

So my question is, how can I determine the actual place on which a control
resides? I looked through the various properties of the System.Web.UI.Page
and was unable to find any property that would tell me immediately where a
control resides. Any insight would be appreciated.

Thanks,
Steve
Nov 17 '05 #1
1 1259
"Steve - DND" <steve!@!digitalnothing.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a custom validation control I have created. One of the actions it
performs is similar to the CustomValidator in that I specify a function to
run, and it goes and runs the function. Previously I had been doing this
with the line:

this.VerifyValidate +=
(VerifyValidateDelegate)Delegate.CreateDelegate(ty peof(VerifyValidateDelegat e), this.Page, m_CustomFunction);

This has worked fine as long as the control resided on an ASPX page. Today I tried using the control for the first time on an ASCX page that I made, and found out that it won't work. I have figured out that the problem is that
with this.Page specified, the CreateDelegate function is looking for the
function I specified on the ASPX page, when I really need it to find the
function on the ASCX page.

So my question is, how can I determine the actual place on which a control
resides? I looked through the various properties of the System.Web.UI.Page
and was unable to find any property that would tell me immediately where a
control resides. Any insight would be appreciated.


Oops... In my haste to post to this group I completely overlooked the
NamingContainer property of my validation control. I was able to put
this.NamingContainer in place of this.Page and now everything works
perfectly.

Steve
Nov 17 '05 #2

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

Similar topics

5
by: codymanix | last post by:
My problem is: I have comboboxes which resides in a usercontrol. Always when the usercontrol changes its visible status (the dialog is shown or you switch to the tabpage where the usercontrol...
0
by: Anonymous | last post by:
Hello, i have developed a web componenet library project, which access the usercontrol that resides in another web application. In my component, I load the control like this: Dim uCtrl As...
2
by: Lokhan Wong | last post by:
My question is whether it's possible to change the properties of a panel, that resides on the webform containing the usercontrol, in the usercontrol itself. Like this: <form> <asp:panel...
1
by: Steve - DND | last post by:
I have a custom validation control I have created. One of the actions it performs is similar to the CustomValidator in that I specify a function to run, and it goes and runs the function....
4
by: Harry | last post by:
Hello, I have a page with a RadioButtonList and a PlaceHolder control. The RadioButtonList's AutoPostBack attribute is set to TRUE and its SelectedIndexChanged event loads one of three...
2
by: Craig Douthitt via DotNetMonster.com | last post by:
I am trying to capture an buttonclick on a usercontrol in the webform the usercontrol resides in. After researching this issue, I've come to believe that the best way of handling this is by raising...
2
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
6
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
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: 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
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.