469,950 Members | 1,783 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

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 1638
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Wayne Brantley | last post: by
4 posts views Thread by asad.naeem | last post: by
4 posts views Thread by =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.