Nested Master Pages

Discussion in 'ASP .Net' started by shapper, Nov 29, 2006.

  1. shapper

    shapper Guest

    Hello,

    I am creating a web site with Nested Master pages.

    I also need to have a class where the culture is set. When the culture
    is changed by the user the page refreshes and the change takes effect.
    I saw this approach, I think, on a MSDN web site or blog:

    Config.vb > Class where culture is set from profile value

    _Base.master > Parent master page

    ( _Navigation > Child master page)

    Default.aspx.vb > Page

    I have this working without the child master page _Navigation. I can't
    make this work with the child master page.

    Could someone help me out with this?

    This is the code for my 3 working pages (Config.vb, _Base.master and
    Defaul.aspx.vb)

    ----- Config.vb -----

    1 Public Class Config
    2 Inherits Page
    3
    4 Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs)
    Handles MyBase.PreInit
    5 Response.Write("Config")
    6 Page.Theme = CType(Context.Profile,
    ProfileCommon).Config.Theme
    7 End Sub
    8
    9 Protected Overrides Sub InitializeCulture()
    10 MyBase.InitializeCulture()
    11 Dim language As String = CType(Context.Profile,
    ProfileCommon).Config.Language
    12 If (language IsNot Nothing) AndAlso (language <> "Auto") Then
    13 MyBase.UICulture = language
    14 Thread.CurrentThread.CurrentCulture =
    CultureInfo.CreateSpecificCulture(language)
    15 End If
    16 End Sub
    17
    18 End Class



    ----- Base.master.vb -----

    1 Partial Class _Base
    2 Inherits System.Web.UI.MasterPage
    3
    4 Protected Sub Page_Init(ByVal sender As Object, ByVal e As
    EventArgs) Handles Me.Init
    5 Response.Write("Base.master")
    6 End Sub
    7
    8 End Class
    9
    10



    ----- Default.aspx.vb -----

    1 Partial Class _Default
    2 Inherits Config
    3
    4 Protected Overloads Sub Page_PreInit(ByVal sender As Object,
    ByVal e As EventArgs) Handles Me.PreInit
    5 Me.MasterPageFile = "~/_Base.master"
    6 End Sub
    7
    8 Protected Sub Page_Init(ByVal sender As Object, ByVal e As
    EventArgs) Handles Me.Init
    9 Response.Write("Default.aspx")
    10 End Sub
    11
    12 End Class

    Could someone help me out in integrating a Child Master page between
    _Base.master and Default.aspx?

    Thanks,

    Miguel
    shapper, Nov 29, 2006
    #1
    1. Advertising

  2. shapper

    shapper Guest

    Please,

    Could someone help me out with this?

    Thanks,

    Miguel

    shapper wrote:
    > Hello,
    >
    > I am creating a web site with Nested Master pages.
    >
    > I also need to have a class where the culture is set. When the culture
    > is changed by the user the page refreshes and the change takes effect.
    > I saw this approach, I think, on a MSDN web site or blog:
    >
    > Config.vb > Class where culture is set from profile value
    >
    > _Base.master > Parent master page
    >
    > ( _Navigation > Child master page)
    >
    > Default.aspx.vb > Page
    >
    > I have this working without the child master page _Navigation. I can't
    > make this work with the child master page.
    >
    > Could someone help me out with this?
    >
    > This is the code for my 3 working pages (Config.vb, _Base.master and
    > Defaul.aspx.vb)
    >
    > ----- Config.vb -----
    >
    > 1 Public Class Config
    > 2 Inherits Page
    > 3
    > 4 Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs)
    > Handles MyBase.PreInit
    > 5 Response.Write("Config")
    > 6 Page.Theme = CType(Context.Profile,
    > ProfileCommon).Config.Theme
    > 7 End Sub
    > 8
    > 9 Protected Overrides Sub InitializeCulture()
    > 10 MyBase.InitializeCulture()
    > 11 Dim language As String = CType(Context.Profile,
    > ProfileCommon).Config.Language
    > 12 If (language IsNot Nothing) AndAlso (language <> "Auto") Then
    > 13 MyBase.UICulture = language
    > 14 Thread.CurrentThread.CurrentCulture =
    > CultureInfo.CreateSpecificCulture(language)
    > 15 End If
    > 16 End Sub
    > 17
    > 18 End Class
    >
    >
    >
    > ----- Base.master.vb -----
    >
    > 1 Partial Class _Base
    > 2 Inherits System.Web.UI.MasterPage
    > 3
    > 4 Protected Sub Page_Init(ByVal sender As Object, ByVal e As
    > EventArgs) Handles Me.Init
    > 5 Response.Write("Base.master")
    > 6 End Sub
    > 7
    > 8 End Class
    > 9
    > 10
    >
    >
    >
    > ----- Default.aspx.vb -----
    >
    > 1 Partial Class _Default
    > 2 Inherits Config
    > 3
    > 4 Protected Overloads Sub Page_PreInit(ByVal sender As Object,
    > ByVal e As EventArgs) Handles Me.PreInit
    > 5 Me.MasterPageFile = "~/_Base.master"
    > 6 End Sub
    > 7
    > 8 Protected Sub Page_Init(ByVal sender As Object, ByVal e As
    > EventArgs) Handles Me.Init
    > 9 Response.Write("Default.aspx")
    > 10 End Sub
    > 11
    > 12 End Class
    >
    > Could someone help me out in integrating a Child Master page between
    > _Base.master and Default.aspx?
    >
    > Thanks,
    >
    > Miguel
    shapper, Nov 29, 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,448
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2005
  2. Doug McCann
    Replies:
    1
    Views:
    993
    William Brogden
    Aug 5, 2004
  3. Replies:
    1
    Views:
    3,191
    PeterKellner
    May 16, 2006
  4. Sam
    Replies:
    0
    Views:
    695
  5. katmagic
    Replies:
    0
    Views:
    1,238
    katmagic
    Dec 26, 2008
Loading...

Share This Page