HowardMarks
MIS
Hi guys
I have a bi-lingual site utilising a masterpage. On each page I have a usercontrol with a 'change language' button, which when clicked cause a postback, which in turn raises a bubble event to the masterpage.
In the bubbled event handler I set the session language variable to reflect the current view language, and let the page finish loading.
The problem is (due to the load order of the page/masterpage/user controls) that the change in language is only reflected on the sections of the page that load after the bubble event handler is called. Upon the next navigational click, the entire page is converted as the session variable had previously been assigned.
How can I overcome this, i.e. set the session variable before anything in the page loads - or, failing that force a page reload after the variable has been set (not really the way I want to go, but something like the pseudocode below).
Nick (Webmaster)
I have a bi-lingual site utilising a masterpage. On each page I have a usercontrol with a 'change language' button, which when clicked cause a postback, which in turn raises a bubble event to the masterpage.
In the bubbled event handler I set the session language variable to reflect the current view language, and let the page finish loading.
The problem is (due to the load order of the page/masterpage/user controls) that the change in language is only reflected on the sections of the page that load after the bubble event handler is called. Upon the next navigational click, the entire page is converted as the session variable had previously been assigned.
How can I overcome this, i.e. set the session variable before anything in the page loads - or, failing that force a page reload after the variable has been set (not really the way I want to go, but something like the pseudocode below).
Code:
Protected Overrides Function OnBubbleEvent(ByVal source As Object, ByVal e As EventArgs) As Boolean
Dim cArgs As System.Web.UI.WebControls.CommandEventArgs = CType(e, System.Web.UI.WebControls.CommandEventArgs)
If cArgs.CommandName = "switchLanguage" Then
Session("sLang") = cArgs.CommandArgument
End If
Page.Reload ****?
End Function
Nick (Webmaster)