473,396 Members | 1,707 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.

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 1465
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.Page) 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****@bellsouth.net> wrote in message
news:_D******************@bignews5.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 "Implementing 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****@bellsouth.net> wrote in message
news:_D******************@bignews5.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
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...
4
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...
2
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 =...
10
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...
3
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 : ...
0
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...
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...
9
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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,...
0
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...
0
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,...

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.