S
shapper
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
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