472,328 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 1701
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...
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...
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...
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. ...
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...
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...
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...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.