Using Master Pages and Base Pages

Discussion in 'ASP .Net' started by =?Utf-8?B?RG9u?=, Sep 12, 2006.

  1. I'm using master pages and have added some base functionality (public
    functions) into this class.

    I then create a new web form using the above as the master page. In the code
    of my new web form, I need to access the custom PEMs of the Master page (I've
    created).
    I find only two ways of doing this (both of which i find unnecessary
    replication of code)
    - Make use of MasterType directive (which I'd have to do manually for each
    and every page I create)
    - Type caste the me.Master to the type required using CTYPE or DIRECTCAST or
    the like.

    Is there any other easier way of achieving the above?
    I would've thought that there would be some setting in the web.config which
    applies such a setting to all pages!
    I'd hate to type either one of the above for each and every page i create
    and use!
     
    =?Utf-8?B?RG9u?=, Sep 12, 2006
    #1
    1. Advertising

  2. Don,

    I personally use the first technique you mention of settting the master type
    on each page I create when I need this functionality.

    That one little line doesn't seem too outrageous to add to each of my pages
    as I create them...

    The only other way to do this that I know of would be to inherit from a base
    page class in the code behind each time you create a page. That is also only
    one line of code, but would also have to be put into each page so setting
    the master type seems much easier to me.


    Regards,

    --
    S. Justin Gengo
    Web Developer / Programmer

    Free code library:
    http://www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche


    "Don" <> wrote in message
    news:...
    > I'm using master pages and have added some base functionality (public
    > functions) into this class.
    >
    > I then create a new web form using the above as the master page. In the
    > code
    > of my new web form, I need to access the custom PEMs of the Master page
    > (I've
    > created).
    > I find only two ways of doing this (both of which i find unnecessary
    > replication of code)
    > - Make use of MasterType directive (which I'd have to do manually for each
    > and every page I create)
    > - Type caste the me.Master to the type required using CTYPE or DIRECTCAST
    > or
    > the like.
    >
    > Is there any other easier way of achieving the above?
    > I would've thought that there would be some setting in the web.config
    > which
    > applies such a setting to all pages!
    > I'd hate to type either one of the above for each and every page i create
    > and use!
     
    S. Justin Gengo, Sep 12, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Electrified Research
    Replies:
    5
    Views:
    2,502
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2005
  2. Doug McCann
    Replies:
    1
    Views:
    1,134
    William Brogden
    Aug 5, 2004
  3. Replies:
    1
    Views:
    3,278
    PeterKellner
    May 16, 2006
  4. katmagic
    Replies:
    0
    Views:
    1,311
    katmagic
    Dec 26, 2008
  5. SMH
    Replies:
    0
    Views:
    622
Loading...

Share This Page