Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page Inheritance

Reply
Thread Tools

Page Inheritance

 
 
Jonathan Wood
Guest
Posts: n/a
 
      12-08-2008
Okay, I searched dozens of Websites tonight for information on page
inheritance. Every single bit of information I found was talking about
code-behind scripting.

What if I don't use code-behind? Does that mean page inheritance is ruled
out? For that matter, how do I have know what the class name is for a page I
create without code behind?

I have an existing page and would like to create a second one that is almost
identical but not quite. Page inheritance would be cool here, but at this
point I don't know if this is possible.

Thanks.

Jonathan

 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      12-08-2008
Page inheritance is a good thing. I am using it in any of my projects.
But i am afraid, you misunderstand what you want.
-----------------
First to answer your question.
You can specify class name using
<%@ Page ClassName="MyClass" %>
and use that name.

--------------------------------

It does not make sence to inherit from page that has HTML. I do not see how
would your HTML mix if let say Page1 has HTML and Page2 has HTML and Page2
inherits from Page1.

You inherit the common method and properties. But not HTML.
For that you need to create page clsStandardPage in APP_CODE folder which
inherits System.UI.Web.Page
And your pages inherit clsStandardPage
<%@ Page Language="C#" Inherits="clsStandardPage"%>

I guess you could create clsStandardPage as aspx page and give it a
ClassName ='clsStandardPage' and inherit from it. But that would be
overkill. Since there is parsing involved. So better create it as a class in
APP_CODE.
---------------------------------------

If you want to reuse HTML on pages then use MasterPage or UserControls.



George.



"Jonathan Wood" <> wrote in message
news:%...
> Okay, I searched dozens of Websites tonight for information on page
> inheritance. Every single bit of information I found was talking about
> code-behind scripting.
>
> What if I don't use code-behind? Does that mean page inheritance is ruled
> out? For that matter, how do I have know what the class name is for a page
> I create without code behind?
>
> I have an existing page and would like to create a second one that is
> almost identical but not quite. Page inheritance would be cool here, but
> at this point I don't know if this is possible.
>
> Thanks.
>
> Jonathan
>


 
Reply With Quote
 
 
 
 
Jonathan Wood
Guest
Posts: n/a
 
      12-08-2008
"George" <> wrote in message
news:...

> Page inheritance is a good thing. I am using it in any of my projects.
> But i am afraid, you misunderstand what you want.


Actually, I know exactly what I want. What I'm having trouble with is what
ASP.NET can do.

> First to answer your question.
> You can specify class name using
> <%@ Page ClassName="MyClass" %>
> and use that name.


Cool.

> It does not make sence to inherit from page that has HTML. I do not see
> how would your HTML mix if let say Page1 has HTML and Page2 has HTML and
> Page2 inherits from Page1.


Well, I think it does make sense. A type of this inheritance occurs with
master pages. And, in fact, I want the exact same layout in my "derived"
page. It would just change the underlying SQL. But perhaps this type of
inheritance is not possible with ASP.NET.

> You inherit the common method and properties. But not HTML.
> For that you need to create page clsStandardPage in APP_CODE folder which
> inherits System.UI.Web.Page
> And your pages inherit clsStandardPage
> <%@ Page Language="C#" Inherits="clsStandardPage"%>


And what kind of file would clsStandardPage be? Just a CS file that declares
a page? I think I follow what you are saying. But if this base page couldn't
handle events from any added controls, it seems like it's use is somewhat
limited.

> I guess you could create clsStandardPage as aspx page and give it a
> ClassName ='clsStandardPage' and inherit from it. But that would be
> overkill. Since there is parsing involved. So better create it as a class
> in APP_CODE.


I might play with that just to better understand what is going on. But
sounds like it won't do what I'd like.

> If you want to reuse HTML on pages then use MasterPage or UserControls.


I already use Master pages. User controls are a possibility. Obviously, I'm
still learning ASP.NET.

Thanks for all the info.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

 
Reply With Quote
 
George
Guest
Posts: n/a
 
      12-08-2008
I see what you want to do.
I guess in your case the output is the same but depends on SQL statement.

I would do it like user control. Add public property like Sql for example.

So it's like following (pseducode)
<%@ Control Language="C#" ClassName="ConfirmOrder"
Inherits="clsUserControlBase"%>
<script runat="server">
string _Sql;
public string SQL
{
get {return _sSql;}
set {_sSql = value;
}
void override Page_Load()
{
DataTable dt = GetData(_sSql);
....blablabla....
}
</script>

Then on your page you could use it like this.

<uc1:ConfirmOrder id=id1 runat=server SQL="SELECT * FROM myTable" />
You declaratively define your SQL.

Or if it's more complicated than that you can assign your SQL on Page_Init
method.

George.


"Jonathan Wood" <> wrote in message
news:...
> "George" <> wrote in message
> news:...
>
>> Page inheritance is a good thing. I am using it in any of my projects.
>> But i am afraid, you misunderstand what you want.

>
> Actually, I know exactly what I want. What I'm having trouble with is what
> ASP.NET can do.
>
>> First to answer your question.
>> You can specify class name using
>> <%@ Page ClassName="MyClass" %>
>> and use that name.

>
> Cool.
>
>> It does not make sence to inherit from page that has HTML. I do not see
>> how would your HTML mix if let say Page1 has HTML and Page2 has HTML and
>> Page2 inherits from Page1.

>
> Well, I think it does make sense. A type of this inheritance occurs with
> master pages. And, in fact, I want the exact same layout in my "derived"
> page. It would just change the underlying SQL. But perhaps this type of
> inheritance is not possible with ASP.NET.
>
>> You inherit the common method and properties. But not HTML.
>> For that you need to create page clsStandardPage in APP_CODE folder which
>> inherits System.UI.Web.Page
>> And your pages inherit clsStandardPage
>> <%@ Page Language="C#" Inherits="clsStandardPage"%>

>
> And what kind of file would clsStandardPage be? Just a CS file that
> declares a page? I think I follow what you are saying. But if this base
> page couldn't handle events from any added controls, it seems like it's
> use is somewhat limited.
>
>> I guess you could create clsStandardPage as aspx page and give it a
>> ClassName ='clsStandardPage' and inherit from it. But that would be
>> overkill. Since there is parsing involved. So better create it as a class
>> in APP_CODE.

>
> I might play with that just to better understand what is going on. But
> sounds like it won't do what I'd like.
>
>> If you want to reuse HTML on pages then use MasterPage or UserControls.

>
> I already use Master pages. User controls are a possibility. Obviously,
> I'm still learning ASP.NET.
>
> Thanks for all the info.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>


 
Reply With Quote
 
Jonathan Wood
Guest
Posts: n/a
 
      12-09-2008

Yeah, it is more complicated than that since I'm correctly implementing
paging (instead of using the braindead default where it requests everything
from the database and then just displays whatever goes in the current page)
and am calling various object methods. I'm a little lost right now. But I'm
sure it could work, possibly with some variation on a user control as you
suggest.

BTW, I tried specifying the class name of a page (ASPX file), then put that
same name as the Inherits value in another page (ASPX file), but I got an
error something about it could not load that class. So I guess it can't work
that way at all?

Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"George" <> wrote in message
news:%23z9YB%...
>I see what you want to do.
> I guess in your case the output is the same but depends on SQL statement.
>
> I would do it like user control. Add public property like Sql for example.
>
> So it's like following (pseducode)
> <%@ Control Language="C#" ClassName="ConfirmOrder"
> Inherits="clsUserControlBase"%>
> <script runat="server">
> string _Sql;
> public string SQL
> {
> get {return _sSql;}
> set {_sSql = value;
> }
> void override Page_Load()
> {
> DataTable dt = GetData(_sSql);
> ....blablabla....
> }
> </script>
>
> Then on your page you could use it like this.
>
> <uc1:ConfirmOrder id=id1 runat=server SQL="SELECT * FROM myTable" />
> You declaratively define your SQL.
>
> Or if it's more complicated than that you can assign your SQL on Page_Init
> method.
>
> George.
>
>
> "Jonathan Wood" <> wrote in message
> news:...
>> "George" <> wrote in message
>> news:...
>>
>>> Page inheritance is a good thing. I am using it in any of my projects.
>>> But i am afraid, you misunderstand what you want.

>>
>> Actually, I know exactly what I want. What I'm having trouble with is
>> what ASP.NET can do.
>>
>>> First to answer your question.
>>> You can specify class name using
>>> <%@ Page ClassName="MyClass" %>
>>> and use that name.

>>
>> Cool.
>>
>>> It does not make sence to inherit from page that has HTML. I do not see
>>> how would your HTML mix if let say Page1 has HTML and Page2 has HTML and
>>> Page2 inherits from Page1.

>>
>> Well, I think it does make sense. A type of this inheritance occurs with
>> master pages. And, in fact, I want the exact same layout in my "derived"
>> page. It would just change the underlying SQL. But perhaps this type of
>> inheritance is not possible with ASP.NET.
>>
>>> You inherit the common method and properties. But not HTML.
>>> For that you need to create page clsStandardPage in APP_CODE folder
>>> which inherits System.UI.Web.Page
>>> And your pages inherit clsStandardPage
>>> <%@ Page Language="C#" Inherits="clsStandardPage"%>

>>
>> And what kind of file would clsStandardPage be? Just a CS file that
>> declares a page? I think I follow what you are saying. But if this base
>> page couldn't handle events from any added controls, it seems like it's
>> use is somewhat limited.
>>
>>> I guess you could create clsStandardPage as aspx page and give it a
>>> ClassName ='clsStandardPage' and inherit from it. But that would be
>>> overkill. Since there is parsing involved. So better create it as a
>>> class in APP_CODE.

>>
>> I might play with that just to better understand what is going on. But
>> sounds like it won't do what I'd like.
>>
>>> If you want to reuse HTML on pages then use MasterPage or UserControls.

>>
>> I already use Master pages. User controls are a possibility. Obviously,
>> I'm still learning ASP.NET.
>>
>> Thanks for all the info.
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>

>


 
Reply With Quote
 
George
Guest
Posts: n/a
 
      12-09-2008

Had you used the <%@ Reference ....@%> in your aspx file?

George


"Jonathan Wood" <> wrote in message
news:%23$QwN$...
> Yeah, it is more complicated than that since I'm correctly implementing
> paging (instead of using the braindead default where it requests
> everything from the database and then just displays whatever goes in the
> current page) and am calling various object methods. I'm a little lost
> right now. But I'm sure it could work, possibly with some variation on a
> user control as you suggest.
>
> BTW, I tried specifying the class name of a page (ASPX file), then put
> that same name as the Inherits value in another page (ASPX file), but I
> got an error something about it could not load that class. So I guess it
> can't work that way at all?
>
> Thanks.
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "George" <> wrote in message
> news:%23z9YB%...
>>I see what you want to do.
>> I guess in your case the output is the same but depends on SQL
>> statement.
>>
>> I would do it like user control. Add public property like Sql for
>> example.
>>
>> So it's like following (pseducode)
>> <%@ Control Language="C#" ClassName="ConfirmOrder"
>> Inherits="clsUserControlBase"%>
>> <script runat="server">
>> string _Sql;
>> public string SQL
>> {
>> get {return _sSql;}
>> set {_sSql = value;
>> }
>> void override Page_Load()
>> {
>> DataTable dt = GetData(_sSql);
>> ....blablabla....
>> }
>> </script>
>>
>> Then on your page you could use it like this.
>>
>> <uc1:ConfirmOrder id=id1 runat=server SQL="SELECT * FROM myTable" />
>> You declaratively define your SQL.
>>
>> Or if it's more complicated than that you can assign your SQL on
>> Page_Init method.
>>
>> George.
>>
>>
>> "Jonathan Wood" <> wrote in message
>> news:...
>>> "George" <> wrote in message
>>> news:...
>>>
>>>> Page inheritance is a good thing. I am using it in any of my projects.
>>>> But i am afraid, you misunderstand what you want.
>>>
>>> Actually, I know exactly what I want. What I'm having trouble with is
>>> what ASP.NET can do.
>>>
>>>> First to answer your question.
>>>> You can specify class name using
>>>> <%@ Page ClassName="MyClass" %>
>>>> and use that name.
>>>
>>> Cool.
>>>
>>>> It does not make sence to inherit from page that has HTML. I do not see
>>>> how would your HTML mix if let say Page1 has HTML and Page2 has HTML
>>>> and Page2 inherits from Page1.
>>>
>>> Well, I think it does make sense. A type of this inheritance occurs with
>>> master pages. And, in fact, I want the exact same layout in my "derived"
>>> page. It would just change the underlying SQL. But perhaps this type of
>>> inheritance is not possible with ASP.NET.
>>>
>>>> You inherit the common method and properties. But not HTML.
>>>> For that you need to create page clsStandardPage in APP_CODE folder
>>>> which inherits System.UI.Web.Page
>>>> And your pages inherit clsStandardPage
>>>> <%@ Page Language="C#" Inherits="clsStandardPage"%>
>>>
>>> And what kind of file would clsStandardPage be? Just a CS file that
>>> declares a page? I think I follow what you are saying. But if this base
>>> page couldn't handle events from any added controls, it seems like it's
>>> use is somewhat limited.
>>>
>>>> I guess you could create clsStandardPage as aspx page and give it a
>>>> ClassName ='clsStandardPage' and inherit from it. But that would be
>>>> overkill. Since there is parsing involved. So better create it as a
>>>> class in APP_CODE.
>>>
>>> I might play with that just to better understand what is going on. But
>>> sounds like it won't do what I'd like.
>>>
>>>> If you want to reuse HTML on pages then use MasterPage or UserControls.
>>>
>>> I already use Master pages. User controls are a possibility. Obviously,
>>> I'm still learning ASP.NET.
>>>
>>> Thanks for all the info.
>>>
>>> --
>>> Jonathan Wood
>>> SoftCircuits Programming
>>> http://www.softcircuits.com
>>>

>>

>


 
Reply With Quote
 
Jonathan Wood
Guest
Posts: n/a
 
      12-09-2008
I hadn't--not familiar with that.

I tried adding the following line to the aspx file that contains my derived
class:

<%@ Reference Page="~/<aspx file>" %>

But I still get the error "Could not load type '<class name>'".

Is there some combination I'm missing?

Thanks.

Jonathan

"George" <> wrote in message
news:...
> Had you used the <%@ Reference ....@%> in your aspx file?
>
> George
>
>
> "Jonathan Wood" <> wrote in message
> news:%23$QwN$...
>> Yeah, it is more complicated than that since I'm correctly implementing
>> paging (instead of using the braindead default where it requests
>> everything from the database and then just displays whatever goes in the
>> current page) and am calling various object methods. I'm a little lost
>> right now. But I'm sure it could work, possibly with some variation on a
>> user control as you suggest.
>>
>> BTW, I tried specifying the class name of a page (ASPX file), then put
>> that same name as the Inherits value in another page (ASPX file), but I
>> got an error something about it could not load that class. So I guess it
>> can't work that way at all?
>>
>> Thanks.
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>> "George" <> wrote in message
>> news:%23z9YB%...
>>>I see what you want to do.
>>> I guess in your case the output is the same but depends on SQL
>>> statement.
>>>
>>> I would do it like user control. Add public property like Sql for
>>> example.
>>>
>>> So it's like following (pseducode)
>>> <%@ Control Language="C#" ClassName="ConfirmOrder"
>>> Inherits="clsUserControlBase"%>
>>> <script runat="server">
>>> string _Sql;
>>> public string SQL
>>> {
>>> get {return _sSql;}
>>> set {_sSql = value;
>>> }
>>> void override Page_Load()
>>> {
>>> DataTable dt = GetData(_sSql);
>>> ....blablabla....
>>> }
>>> </script>
>>>
>>> Then on your page you could use it like this.
>>>
>>> <uc1:ConfirmOrder id=id1 runat=server SQL="SELECT * FROM myTable" />
>>> You declaratively define your SQL.
>>>
>>> Or if it's more complicated than that you can assign your SQL on
>>> Page_Init method.
>>>
>>> George.
>>>
>>>
>>> "Jonathan Wood" <> wrote in message
>>> news:...
>>>> "George" <> wrote in message
>>>> news:...
>>>>
>>>>> Page inheritance is a good thing. I am using it in any of my projects.
>>>>> But i am afraid, you misunderstand what you want.
>>>>
>>>> Actually, I know exactly what I want. What I'm having trouble with is
>>>> what ASP.NET can do.
>>>>
>>>>> First to answer your question.
>>>>> You can specify class name using
>>>>> <%@ Page ClassName="MyClass" %>
>>>>> and use that name.
>>>>
>>>> Cool.
>>>>
>>>>> It does not make sence to inherit from page that has HTML. I do not
>>>>> see how would your HTML mix if let say Page1 has HTML and Page2 has
>>>>> HTML and Page2 inherits from Page1.
>>>>
>>>> Well, I think it does make sense. A type of this inheritance occurs
>>>> with master pages. And, in fact, I want the exact same layout in my
>>>> "derived" page. It would just change the underlying SQL. But perhaps
>>>> this type of inheritance is not possible with ASP.NET.
>>>>
>>>>> You inherit the common method and properties. But not HTML.
>>>>> For that you need to create page clsStandardPage in APP_CODE folder
>>>>> which inherits System.UI.Web.Page
>>>>> And your pages inherit clsStandardPage
>>>>> <%@ Page Language="C#" Inherits="clsStandardPage"%>
>>>>
>>>> And what kind of file would clsStandardPage be? Just a CS file that
>>>> declares a page? I think I follow what you are saying. But if this base
>>>> page couldn't handle events from any added controls, it seems like it's
>>>> use is somewhat limited.
>>>>
>>>>> I guess you could create clsStandardPage as aspx page and give it a
>>>>> ClassName ='clsStandardPage' and inherit from it. But that would be
>>>>> overkill. Since there is parsing involved. So better create it as a
>>>>> class in APP_CODE.
>>>>
>>>> I might play with that just to better understand what is going on. But
>>>> sounds like it won't do what I'd like.
>>>>
>>>>> If you want to reuse HTML on pages then use MasterPage or
>>>>> UserControls.
>>>>
>>>> I already use Master pages. User controls are a possibility. Obviously,
>>>> I'm still learning ASP.NET.
>>>>
>>>> Thanks for all the info.
>>>>
>>>> --
>>>> Jonathan Wood
>>>> SoftCircuits Programming
>>>> http://www.softcircuits.com
>>>>
>>>

>>

>


 
Reply With Quote
 
George
Guest
Posts: n/a
 
      12-09-2008
Can you show me those 2 pages... strip irrelevant HTML.
Just leave the @Page from BOTH pages, @Reference tags and line of code where
you using the class name.

George



"Jonathan Wood" <> wrote in message
news:...
>I hadn't--not familiar with that.
>
> I tried adding the following line to the aspx file that contains my
> derived class:
>
> <%@ Reference Page="~/<aspx file>" %>
>
> But I still get the error "Could not load type '<class name>'".
>
> Is there some combination I'm missing?
>
> Thanks.
>
> Jonathan
>
> "George" <> wrote in message
> news:...
>> Had you used the <%@ Reference ....@%> in your aspx file?
>>
>> George
>>
>>
>> "Jonathan Wood" <> wrote in message
>> news:%23$QwN$...
>>> Yeah, it is more complicated than that since I'm correctly implementing
>>> paging (instead of using the braindead default where it requests
>>> everything from the database and then just displays whatever goes in the
>>> current page) and am calling various object methods. I'm a little lost
>>> right now. But I'm sure it could work, possibly with some variation on a
>>> user control as you suggest.
>>>
>>> BTW, I tried specifying the class name of a page (ASPX file), then put
>>> that same name as the Inherits value in another page (ASPX file), but I
>>> got an error something about it could not load that class. So I guess it
>>> can't work that way at all?
>>>
>>> Thanks.
>>>
>>> --
>>> Jonathan Wood
>>> SoftCircuits Programming
>>> http://www.softcircuits.com
>>>
>>> "George" <> wrote in message
>>> news:%23z9YB%...
>>>>I see what you want to do.
>>>> I guess in your case the output is the same but depends on SQL
>>>> statement.
>>>>
>>>> I would do it like user control. Add public property like Sql for
>>>> example.
>>>>
>>>> So it's like following (pseducode)
>>>> <%@ Control Language="C#" ClassName="ConfirmOrder"
>>>> Inherits="clsUserControlBase"%>
>>>> <script runat="server">
>>>> string _Sql;
>>>> public string SQL
>>>> {
>>>> get {return _sSql;}
>>>> set {_sSql = value;
>>>> }
>>>> void override Page_Load()
>>>> {
>>>> DataTable dt = GetData(_sSql);
>>>> ....blablabla....
>>>> }
>>>> </script>
>>>>
>>>> Then on your page you could use it like this.
>>>>
>>>> <uc1:ConfirmOrder id=id1 runat=server SQL="SELECT * FROM myTable" />
>>>> You declaratively define your SQL.
>>>>
>>>> Or if it's more complicated than that you can assign your SQL on
>>>> Page_Init method.
>>>>
>>>> George.
>>>>
>>>>
>>>> "Jonathan Wood" <> wrote in message
>>>> news:...
>>>>> "George" <> wrote in message
>>>>> news:...
>>>>>
>>>>>> Page inheritance is a good thing. I am using it in any of my
>>>>>> projects.
>>>>>> But i am afraid, you misunderstand what you want.
>>>>>
>>>>> Actually, I know exactly what I want. What I'm having trouble with is
>>>>> what ASP.NET can do.
>>>>>
>>>>>> First to answer your question.
>>>>>> You can specify class name using
>>>>>> <%@ Page ClassName="MyClass" %>
>>>>>> and use that name.
>>>>>
>>>>> Cool.
>>>>>
>>>>>> It does not make sence to inherit from page that has HTML. I do not
>>>>>> see how would your HTML mix if let say Page1 has HTML and Page2 has
>>>>>> HTML and Page2 inherits from Page1.
>>>>>
>>>>> Well, I think it does make sense. A type of this inheritance occurs
>>>>> with master pages. And, in fact, I want the exact same layout in my
>>>>> "derived" page. It would just change the underlying SQL. But perhaps
>>>>> this type of inheritance is not possible with ASP.NET.
>>>>>
>>>>>> You inherit the common method and properties. But not HTML.
>>>>>> For that you need to create page clsStandardPage in APP_CODE folder
>>>>>> which inherits System.UI.Web.Page
>>>>>> And your pages inherit clsStandardPage
>>>>>> <%@ Page Language="C#" Inherits="clsStandardPage"%>
>>>>>
>>>>> And what kind of file would clsStandardPage be? Just a CS file that
>>>>> declares a page? I think I follow what you are saying. But if this
>>>>> base page couldn't handle events from any added controls, it seems
>>>>> like it's use is somewhat limited.
>>>>>
>>>>>> I guess you could create clsStandardPage as aspx page and give it a
>>>>>> ClassName ='clsStandardPage' and inherit from it. But that would be
>>>>>> overkill. Since there is parsing involved. So better create it as a
>>>>>> class in APP_CODE.
>>>>>
>>>>> I might play with that just to better understand what is going on. But
>>>>> sounds like it won't do what I'd like.
>>>>>
>>>>>> If you want to reuse HTML on pages then use MasterPage or
>>>>>> UserControls.
>>>>>
>>>>> I already use Master pages. User controls are a possibility.
>>>>> Obviously, I'm still learning ASP.NET.
>>>>>
>>>>> Thanks for all the info.
>>>>>
>>>>> --
>>>>> Jonathan Wood
>>>>> SoftCircuits Programming
>>>>> http://www.softcircuits.com
>>>>>
>>>>
>>>

>>

>


 
Reply With Quote
 
Jonathan Wood
Guest
Posts: n/a
 
      12-09-2008

Hi George,

> Can you show me those 2 pages... strip irrelevant HTML.
> Just leave the @Page from BOTH pages, @Reference tags and line of code
> where you using the class name.


Sure. At this point, there is no code referencing the class name. I'm just
trying to see if I can make one page look like another by deriving its
content. I could play with things from there.

===== [[ Listings.aspx ]] =====

<%@ Page Title="SoundFilesOnline" Language="C#"
MasterPageFile="~/Default.master" ClassName="ListingsPage" %>
<%@ OutputCache Duration="60" VaryByParam="cat;page" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="SoftCircuits" %>

<script runat="server">

</script>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

</asp:Content>

===== [[ Default2.aspx ]] =====
<%@ Page Title="" Language="C#" MasterPageFile="~/Default.master"
Inherits="ListingsPage" %>
<%@ Reference Page="~/Listings.aspx" %>

<script runat="server">

</script>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

</asp:Content>

Thanks.

Jonathan

 
Reply With Quote
 
George
Guest
Posts: n/a
 
      12-09-2008

I see now... I apologize for misleading you.
I am afraid you can not use it in Inherits property.

The reason is that because @Page directive is processed first, before
@Reference directive.
So you can use type ListingsPage anywhere in the code (using the
@Reference). But apparently can not in the Inherits property.

-----------------------------
But again I would suggest to rethink your approach. I honestly do not see
what will you achieve by Inheriting HTML from another page.
Your best bet is to use UserContols for that. And if you only need to
inherit functionality then create separate class.

George.







"Jonathan Wood" <> wrote in message
news:uLu%...
> Hi George,
>
>> Can you show me those 2 pages... strip irrelevant HTML.
>> Just leave the @Page from BOTH pages, @Reference tags and line of code
>> where you using the class name.

>
> Sure. At this point, there is no code referencing the class name. I'm just
> trying to see if I can make one page look like another by deriving its
> content. I could play with things from there.
>
> ===== [[ Listings.aspx ]] =====
>
> <%@ Page Title="SoundFilesOnline" Language="C#"
> MasterPageFile="~/Default.master" ClassName="ListingsPage" %>
> <%@ OutputCache Duration="60" VaryByParam="cat;page" %>
> <%@ Import Namespace="System.Data" %>
> <%@ Import Namespace="SoftCircuits" %>
>
> <script runat="server">
>
> </script>
>
> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1"
> Runat="Server">
>
> </asp:Content>
>
> ===== [[ Default2.aspx ]] =====
> <%@ Page Title="" Language="C#" MasterPageFile="~/Default.master"
> Inherits="ListingsPage" %>
> <%@ Reference Page="~/Listings.aspx" %>
>
> <script runat="server">
>
> </script>
>
> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1"
> Runat="Server">
>
> </asp:Content>
>
> Thanks.
>
> Jonathan
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Struct inheritance against class inheritance johnsonlau C++ 1 07-21-2008 04:58 PM
Interface inheritance vs Implementation inheritance. Daniel Pitts Java 27 02-27-2008 01:37 AM
Private Inheritance and Publice Inheritance karthikbalaguru C++ 9 09-10-2007 01:05 PM
mul. inheritance & overloading operator new/delete solved by virtual base inheritance? cppsks C++ 0 10-27-2004 07:49 PM
Private access modifier and Inheritance (Inheritance implementation in Java) maxw_cc Java 1 12-21-2003 11:38 AM



Advertisments