,when i am click the the arabic button instead on one click i have to take two cliks,i dono y
then i am clicking arabic button the page is getting converted into arabic but when i am clicking the next hyperlink dat pages is also converted into arabic n when i am trying to clike the previous page or the next hyperlink,the page is loosing its control
and comming back into english,so anyone solve it i am waitin for the reply,
i dosent understand y i have to click the button twice to change the page in to arabic or english
If you set the globalization in button click event handler, it will be applied in the next postback only. After clicking the button first time, refresh the page agian will load the page in the desired lanugage. To avoid this you need to set the language
setting in the
InitializeCulture() method of the page class. refer the url for more
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about
it ,this is my base calss code
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
imranwahabit
Member
15 Points
104 Posts
globalization
Jan 09, 2010 07:16 AM|LINK
,when i am click the the arabic button instead on one click i have to take two cliks,i dono y
then i am clicking arabic button the page is getting converted into arabic but when i am clicking the next hyperlink dat pages is also converted into arabic n when i am trying to clike the previous page or the next hyperlink,the page is loosing its control and comming back into english,so anyone solve it i am waitin for the reply,
i dosent understand y i have to click the button twice to change the page in to arabic or english
</div> <div>muhammad imran</div>sreejukg
All-Star
28177 Points
4214 Posts
Re: globalization
Jan 09, 2010 03:31 PM|LINK
If you set the globalization in button click event handler, it will be applied in the next postback only. After clicking the button first time, refresh the page agian will load the page in the desired lanugage. To avoid this you need to set the language setting in the
http://www.codeproject.com/KB/aspnet/localizationByVivekTakur.aspx
My Blog
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat mistake i hav e
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat mistake i have dont
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat mistake i have done an
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat mistake i have
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat mistake i
imranwahabit
Member
15 Points
104 Posts
Re: globalization
Jan 11, 2010 07:21 AM|LINK
hello,as u gave the site details i got an clear idea n i am thanx ful for it,n can u just let me know wheter where i have to writhe the initialize cultre()in my application as i am pasting the masterpage code just have a look in it n let me inform about it ,this is my base calss code
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Threading
Imports System.Globalization
Imports Microsoft.VisualBasic
Imports System
Public Class BasePage
Inherits Page
Public Sub Arabic()
SetCulture("ar-SA", "ar-SA")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Public Sub Engilsh()
SetCulture("en-US", "en-US")
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
Protected Sub SetCulture(ByVal name As String, ByVal locale As String)
Try
Thread.CurrentThread.CurrentUICulture = New CultureInfo(name)
Thread.CurrentThread.CurrentCulture = New CultureInfo(locale)
Session("MyUICulture") = Thread.CurrentThread.CurrentUICulture
Session("MyCulture") = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyUICulture") IsNot Nothing AndAlso Session("MyCulture") IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = DirectCast(Session("MyUICulture"), CultureInfo)
Thread.CurrentThread.CurrentCulture = DirectCast(Session("MyCulture"), CultureInfo)
End If
End Sub
End Class
and this is my master.vb code
Imports System.Data
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End If
End Sub
Protected Sub BtnArabic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnArabic.Click
Arabic()
Session("language") = "Arabic"
Session("PageDir") = "rtl"
Response.Write(Session("language").ToString())
End Sub
Protected Sub BtnEnglish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEnglish.Click
English()
Session("language") = "English"
Session("PageDir") = "ltr"
Response.Write(Session("language").ToString())
End Sub
Private Sub English()
Dim obj As New BasePage()
obj.Engilsh()
End Sub
Private Sub Arabic()
Dim obj As New BasePage()
obj.Arabic()
End Sub
End Class
wat mistake i have done n y