Re: web page and masterpage base classes

Mark Aurit <[email protected]> Fri, 7 Sep 2007 08:10:42 -0700
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
Thanks.
As Ive thought about it, the items I particularly have "issues" with are
those that access state, be it in session or in cookies. I use a single
function for this (see pseudo code below) and since I use it extensively
in my apps it logically goes into the base class, but either base class
(web pages or master pages) may need it.  And since these base classes
inherit from different SYSTEM.WEB.UI classes, I am not clear on the
cleanest way to do this.

public string GetState(enumStateId eId)
{
if (eId=enumStateId.PersonName)
    return personNameFromSessionSrate;
else if (eId=enumStateId.PersonId)
    return personIdFromSessionState;
}

Efran Cobisi, cobisi.com wrote:
> Mark,
>
> I'd rather extract the required functionalities and put them in another
> class, which I'd use in both my base and master pages: this one would be
> the best approach to follow.
> It is possible, however, to have the page access its associated master
> page and vice versa. Have a look to the Master property of the Page
> class and to the Page property of the MasterPage class respectively.
>
> Hope this helps.
>
> --
> Efran Cobisi
> http://www.cobisi.com
>
> Mark Aurit wrote:
>> I use a base page (which inherits from System.Web.UI.Page) behind my
>> .aspx, and I have a similar one behind my masterpage (inheriting from
>> System.Web.UI.MasterPage).  Im seeing the need by both to use many of
>> the same functions, but Im assuming I cant use the same for both.  Ive
>> played the cut-and-paste inheritance in the paste, and am not a fan.
>> Does anyone have any advice for a good strategy to do this? (share the
>> same functions between different base pages)
>> Thanks very much
>> Mark
>>
>> ===================================
>> This list is hosted by DevelopMentorֲ®  http://www.develop.com
>>
>> View archives and manage your subscription(s) at
>> http://discuss.develop.com
>>
>>
>
> ===================================
> This list is hosted by DevelopMentorֲ®  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentorֲ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com