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

Access inherited aspx control from base aspx ?

Hello
I am using C#, .net1.1
Vis Studio 2003
I am using homeBase.aspx.cs page as a base for several other
aspx/aspx.cs web pages. The base page handles some operations that are
common to all pages. like this:
somepage...
public class homeBase : System.Web.UI.Page
....
then other pages.....
public class WebForm1 : DBMS.homeBase
public class WebForm2 : DBMS.homeBase
etc..

I never actually use the homeBase.aspx page for anything.
I would like to put a label in the same place on all my inherited aspx
pages and set the Text property from the base page code.
Now I am quite sure that the asp code in the base can not be
inherited. I can't just place a label on homeBase.aspx and expect it
to show up in WebForm2, although that would be ideal. So, is there a
way that I can place the label on every inherited form
WebForm1.Label1, WebForm2.Label1, etc..and then access it (Label1)
from the homeBase.aspx.cs code, every time one of these inherited
forms loads?

I tried to create Label1 on the inherited forms and also create one on
homeBase.aspx. page. (just so the code would be generated the same in
all places) . Now the problems begin when I compile.
WebForm1 gets an error at the label declaration stating that it needs
to have the word NEW in front of it "because it hides inherited member
DBMS.homeBase.Label1". To spare the details, (unless required) from
there it is all down hill.

Phew
Any ideas? tryed to be clear without to many words...
Thanks
Jeff

Dec 2 '05 #1
3 1763
you have two choices

1) delete the label declaration in the inherited page (and thus use the base
declartion). don't use new (as then they are two variables).

2) use Page.Find() in the basepage to access the label

-- bruce (sqlwork.com)

"Jeff User" <je*******@hotmail.com> wrote in message
news:ck********************************@4ax.com...
Hello
I am using C#, .net1.1
Vis Studio 2003
I am using homeBase.aspx.cs page as a base for several other
aspx/aspx.cs web pages. The base page handles some operations that are
common to all pages. like this:
somepage...
public class homeBase : System.Web.UI.Page
...
then other pages.....
public class WebForm1 : DBMS.homeBase
public class WebForm2 : DBMS.homeBase
etc..

I never actually use the homeBase.aspx page for anything.
I would like to put a label in the same place on all my inherited aspx
pages and set the Text property from the base page code.
Now I am quite sure that the asp code in the base can not be
inherited. I can't just place a label on homeBase.aspx and expect it
to show up in WebForm2, although that would be ideal. So, is there a
way that I can place the label on every inherited form
WebForm1.Label1, WebForm2.Label1, etc..and then access it (Label1)
from the homeBase.aspx.cs code, every time one of these inherited
forms loads?

I tried to create Label1 on the inherited forms and also create one on
homeBase.aspx. page. (just so the code would be generated the same in
all places) . Now the problems begin when I compile.
WebForm1 gets an error at the label declaration stating that it needs
to have the word NEW in front of it "because it hides inherited member
DBMS.homeBase.Label1". To spare the details, (unless required) from
there it is all down hill.

Phew
Any ideas? tryed to be clear without to many words...
Thanks
Jeff

Dec 2 '05 #2
Fabulous !!
I opted to
1) delete the label declaration in the inherited page (and thus use
the base declartion).
Works like a charm!!

Are there any benefits or pitfalls to doing this one way over the
other?
Thanks
Jeff
On Thu, 1 Dec 2005 17:16:30 -0800, "Bruce Barker"
<br******************@safeco.com> wrote:
you have two choices

1) delete the label declaration in the inherited page (and thus use the base
declartion). don't use new (as then they are two variables).

2) use Page.Find() in the basepage to access the label

-- bruce (sqlwork.com)

"Jeff User" <je*******@hotmail.com> wrote in message
news:ck********************************@4ax.com.. .
Hello
I am using C#, .net1.1
Vis Studio 2003
I am using homeBase.aspx.cs page as a base for several other
aspx/aspx.cs web pages. The base page handles some operations that are
common to all pages. like this:
somepage...
public class homeBase : System.Web.UI.Page
...
then other pages.....
public class WebForm1 : DBMS.homeBase
public class WebForm2 : DBMS.homeBase
etc..

I never actually use the homeBase.aspx page for anything.
I would like to put a label in the same place on all my inherited aspx
pages and set the Text property from the base page code.
Now I am quite sure that the asp code in the base can not be
inherited. I can't just place a label on homeBase.aspx and expect it
to show up in WebForm2, although that would be ideal. So, is there a
way that I can place the label on every inherited form
WebForm1.Label1, WebForm2.Label1, etc..and then access it (Label1)
from the homeBase.aspx.cs code, every time one of these inherited
forms loads?

I tried to create Label1 on the inherited forms and also create one on
homeBase.aspx. page. (just so the code would be generated the same in
all places) . Now the problems begin when I compile.
WebForm1 gets an error at the label declaration stating that it needs
to have the word NEW in front of it "because it hides inherited member
DBMS.homeBase.Label1". To spare the details, (unless required) from
there it is all down hill.

Phew
Any ideas? tryed to be clear without to many words...
Thanks
Jeff


Dec 2 '05 #3
Well, I can see 1 problem already.
Everytime you open the aspx page again and then the solution
re-compiles, it re-creates the declaration.

I will have to look into maybe creating them at run-time.
Yes/no, any thoughts?

Jeff
On Fri, 02 Dec 2005 03:56:07 GMT, Jeff User <je*******@hotmail.com>
wrote:
Fabulous !!
I opted to
1) delete the label declaration in the inherited page (and thus use
the base declartion).
Works like a charm!!

Are there any benefits or pitfalls to doing this one way over the
other?
Thanks
Jeff
On Thu, 1 Dec 2005 17:16:30 -0800, "Bruce Barker"
<br******************@safeco.com> wrote:
you have two choices

1) delete the label declaration in the inherited page (and thus use the base
declartion). don't use new (as then they are two variables).

2) use Page.Find() in the basepage to access the label

-- bruce (sqlwork.com)

"Jeff User" <je*******@hotmail.com> wrote in message
news:ck********************************@4ax.com. ..
Hello
I am using C#, .net1.1
Vis Studio 2003
I am using homeBase.aspx.cs page as a base for several other
aspx/aspx.cs web pages. The base page handles some operations that are
common to all pages. like this:
somepage...
public class homeBase : System.Web.UI.Page
...
then other pages.....
public class WebForm1 : DBMS.homeBase
public class WebForm2 : DBMS.homeBase
etc..

I never actually use the homeBase.aspx page for anything.
I would like to put a label in the same place on all my inherited aspx
pages and set the Text property from the base page code.
Now I am quite sure that the asp code in the base can not be
inherited. I can't just place a label on homeBase.aspx and expect it
to show up in WebForm2, although that would be ideal. So, is there a
way that I can place the label on every inherited form
WebForm1.Label1, WebForm2.Label1, etc..and then access it (Label1)
from the homeBase.aspx.cs code, every time one of these inherited
forms loads?

I tried to create Label1 on the inherited forms and also create one on
homeBase.aspx. page. (just so the code would be generated the same in
all places) . Now the problems begin when I compile.
WebForm1 gets an error at the label declaration stating that it needs
to have the word NEW in front of it "because it hides inherited member
DBMS.homeBase.Label1". To spare the details, (unless required) from
there it is all down hill.

Phew
Any ideas? tryed to be clear without to many words...
Thanks
Jeff


Dec 2 '05 #4

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

Similar topics

1
by: Dave | last post by:
Hello NG, Regarding access-declarations and member using-declarations as used to change the access level of an inherited base member... Two things need to be considered when determining an...
8
by: TS | last post by:
I am trying to get set a property of a control on the inherited class from base class. I imagine i have to use reflection, so could someone give me the code to do it? something like this?...
0
by: seven | last post by:
I have a base page with an HTMLForm object (added to the base page control heiarchy during Init). In the design of pages derived from this base page, I can choose to create controls and add them...
8
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and...
4
by: JC Voon | last post by:
Hi: My base form has a button, when click it will call MessageBox.Show( "Base form" ). I inherite a child form from the base and assign a button click event to the same button which will call...
3
by: Wayne Brantley | last post by:
VS2005 RTM Create a web user control to use as a base class for other web user controls. Now, create a new web user control, change the class it inherits from to your base class and compile....
4
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on...
10
by: Smokey Grindle | last post by:
i want to inherit the list view class, but in the inherited class, hide the Header style property and the view property (basically its a detailed list with always clickable headers) how do I keep...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I have a user control that is designed as below. I am creating these User Controls Dynamically in another form. They are multiple types of User Controls all with a common Interface so I can...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.