473,796 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing _Default page from a child derived from UserControl (Express 2005)

RKT
(Web Developer Express 2005, CSharp, C#)

I've searched high and low...

If have the typical _Default page. In it is a MultiView that contains
another MultiView - in both of those are Views containing my specialized
UserControls.

In any of those views, I need to acess the _Default page (parent, several
times removed). I would like a strongly typed mechanism, but at this point,
would settle to downcast it.

But I can't seem to be able to use it's 'type' in an expression without the
compiler complaint that the type is not known.

I have tried various efforts to define, reference or import the namespace
including the @Directives in the .ascx files. The only mechanism that seems
valid results in a complaint of circular reference.

(Have seen MasterPage-related directive that may work, but not using that
architecture (yet...))

Is there a prescribed method to do this?
Jan 28 '06 #1
2 1482
Hi,

see this:

Understanding Page Inheritance in ASP.NET 2.0
http://west-wind.com/weblog/posts/3016.aspx

The solution is described almost at end of the post.

Summarized:

- Create a base class for your _Default Page (class inheriting from
System.Web.UI.P age) and place it in App_Code
- make your _Default page to inherit from thios base page class
- When accessing the Page from user control, use Control's own Page property
but cast to the base type

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"RKT" <ss****@bellsou th.net> wrote in message
news:_D******** **********@bign ews5.bellsouth. net...
(Web Developer Express 2005, CSharp, C#)

I've searched high and low...

If have the typical _Default page. In it is a MultiView that contains
another MultiView - in both of those are Views containing my specialized
UserControls.

In any of those views, I need to acess the _Default page (parent, several
times removed). I would like a strongly typed mechanism, but at this
point,
would settle to downcast it.

But I can't seem to be able to use it's 'type' in an expression without
the
compiler complaint that the type is not known.

I have tried various efforts to define, reference or import the namespace
including the @Directives in the .ascx files. The only mechanism that
seems
valid results in a complaint of circular reference.

(Have seen MasterPage-related directive that may work, but not using that
architecture (yet...))

Is there a prescribed method to do this?

Jan 28 '06 #2
And to add,

there's also "Implementi ng Base Pages" thread in this newsgroup (started Jan
21st) where I have demonstrated the mechanism you could also apply.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"RKT" <ss****@bellsou th.net> wrote in message
news:_D******** **********@bign ews5.bellsouth. net...
(Web Developer Express 2005, CSharp, C#)

I've searched high and low...

If have the typical _Default page. In it is a MultiView that contains
another MultiView - in both of those are Views containing my specialized
UserControls.

In any of those views, I need to acess the _Default page (parent, several
times removed). I would like a strongly typed mechanism, but at this
point,
would settle to downcast it.

But I can't seem to be able to use it's 'type' in an expression without
the
compiler complaint that the type is not known.

I have tried various efforts to define, reference or import the namespace
including the @Directives in the .ascx files. The only mechanism that
seems
valid results in a complaint of circular reference.

(Have seen MasterPage-related directive that may work, but not using that
architecture (yet...))

Is there a prescribed method to do this?

Jan 28 '06 #3

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

Similar topics

4
9785
by: james | last post by:
I have a custom UserControl, which can have many sub class levels derived from it. I want to be able to discover all the components at Load time, but the only components I can see from the base class are the private components internal to the base class itself. What I want are ALL components for the entire class no matter how many levels of sub-classing this particular control contains. I do not want to have to force the child classes to...
4
6168
by: TdarTdar | last post by:
Hi, How do you solve this problem, I seen a web page about this but I still very new to asp.net so please elaborate thanks ? Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: The type '_Default' is ambiguous: it could come from
2
1713
by: Vivek Sharma | last post by:
Hi There, I have a situation where I wish to load the controls dynamically on the basis of user role. Hence, I am using this code. if (UserRole == "IS Administrator") { Control UC1 = LoadControl("../UserControls/ISJob/uctlJobGeneral.ascx");
10
4030
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
3
5006
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
0
1272
by: dkode | last post by:
Hello, I know this can be done, but it's beyond me at the moment, Here is my inheritance chain: class NavRole : UserControl { protected void AddSubmenu(string submenuFile); } class artist : NavRole {}
10
2429
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...
9
2651
by: J055 | last post by:
Hi I have a standard asp page which uses a MasterPage. The MasterPage contains a User control. How can I access a public method in the User control from my WebForm page? I can't move the method to another location because it populates a Textbox in the user control page. Thanks Andrew
5
2818
by: gregarican | last post by:
There is a C# CTI app I'm working on using Visual Studio 2005 at revision level 8.0.50727-7600. I need a couple of Windows Form Button controls to emulate line buttons on a telephone. So I went to create a class file for the user control to subclass this out. Something basic for a start, just initializing things. When I drag this custom control from the Toolbox to my form then Visual Studio just abruptly exits without warning. So I...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
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
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10003
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...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
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...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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.