473,809 Members | 2,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.VerifyVali date +=
(VerifyValidate Delegate)Delega te.CreateDelega te(typeof(Verif yValidateDelega t
e), this.Page, m_CustomFunctio n);

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.P age
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 1271
"Steve - DND" <steve!@!digita lnothing.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.VerifyVali date +=
(VerifyValidate Delegate)Delega te.CreateDelega te(typeof(Verif yValidateDelega t e), this.Page, m_CustomFunctio n);

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.P age
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.NamingCont ainer 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
1463
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 is), all text is selected in the textfield of the combobox. Is this a Bug? If yes, is there a workaround? -- cody
0
1165
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 New UserControl uCtrl.LoadControl("/intranet/myfile.ascx") uCtrl.ID = "NestedGrid"
2
1816
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 visibility=false .... </asp panel> <user:control> //a function here turns the visibilty to true </user:control>
1
251
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. Previously I had been doing this with the line: this.VerifyValidate += (VerifyValidateDelegate)Delegate.CreateDelegate(typeof(VerifyValidateDelegat e), this.Page, m_CustomFunction); This has worked fine as long as the control resided on an ASPX page....
4
3123
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 UserControls into the PlaceHolder's child control collection depending upon which of the three radio buttons is selected. Each of the three UserControls have postback events themselves triggered by button clicks. The problem I'm having is keeping track of...
2
1395
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 an event in the control and consuming the event in the webform. I tried the following, unfortunatly while the usercontrol raises the event the webform method does not react. UserControl (Named WebUserControl1 contains one button) Public...
2
4640
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 for me! I apologize for the length of this posting, but I wanted to make sure that I get an answer other than "Hey man, just use LoadControl!", because this is not what I want. The Task: Isolate a collection of web forms which are created as
12
2217
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 server. It "serves" back the required control (either WebControl or UserControl) based on the contents of an xml file. The code in the webform places each control in a TableCell. My problem is that the control server works as far as returning the...
6
12144
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 binding like normal. The problem I am running into is that my UserControl ends up with a different BindingContext then the ParentForm it is contained in and thus all other controls on the parent form. (I want various controls on the form to...
10
2432
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 my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from the codebehind of the UserControl? For instance, suppose that the UserControl is dropped inside one...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10387
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
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 we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.