locked
Code Inheritance for localization RRS feed

  • Question

  • User-1052930297 posted

    Hi to all, 

    I'm working in localizing a web site and I found a video that describes an Override method on the content page as:

    Imports System.Threading

    Imports System.Globalization

    Partial Class _Default

    Inherits System.Web.UI.Page

    Protected Overrides Sub InitializeCulture()

    Dim lang As String = Session("LangSelected")

    If lang IsNot Nothing Or lang <> "" Then

    Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang)

    'Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang)

    End If

    End Sub

    End Class

     Is it possible to have it in a separate file in app_code and have all pages inherit the code from there?

    Thanks!

    Tuesday, March 13, 2007 6:01 AM

Answers

  • User-294030300 posted

    Hey,

    Sure, I do that all the time.  I have a custom code page like this:

    public class CustomPageBase
        Inherits System.Web.UI.Page


        'Do whatever
    End class

    Then default looks like:

    Public class _Default
        inherits CustomPageBase


    End class

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 13, 2007 7:44 AM

All replies

  • User-294030300 posted

    Hey,

    Sure, I do that all the time.  I have a custom code page like this:

    public class CustomPageBase
        Inherits System.Web.UI.Page


        'Do whatever
    End class

    Then default looks like:

    Public class _Default
        inherits CustomPageBase


    End class

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 13, 2007 7:44 AM
  • User-1052930297 posted

    Thank you bmain

    It was so simple... you are great.

    Stelios

    Tuesday, March 13, 2007 7:56 AM