Use Session variable, which can identify - In which culture the site is running.
So when u press button , in that click event of button change the session variable to that culture & based on Culture Session variable , you can set your culture using basepage or page init event..
Hope this will help !!!
Please mark as answer if it helps you.
Ramani Sandeep (My Blog)
(MCTS, MCC-2011)
Ive come back to this thread to give one important feedback on what I've learned since I made multiligual sites.
If you want search engines to index all language versions of your site, you need to use the query string method.
If not, search engines will NOT index all languages on your site.
This is because search engines will only index an url once. So if a page is in french and english and both share the same url, withought a query string, you will only be able to index one version of that page.
With a query string, it is seen as a different page because it has a different url.
I put my french version with a lang=fr query string and put no query sting on english. This makes english my default language. All other languages have a query string.
If there is no query string, show the default language, if not, choose the language according to the "lang" query.
This solved my problem bieautifully. All my pages are now indexed.
Member
10 Points
46 Posts
Changing language using buttons instead of drop down list
Dec 03, 2010 10:32 AM|Marquis_DeBlodey|LINK
I can change the language of my site using a drop down list put I cant do it with buttons.
I have a button for each language. The user clicks on a button to choose their language.
The problem is that the "button click" code happens after the "Initialize Culture" Code.
So the language only changes after a page refresh.
I don't want to use parameters e.i. www.mysite.com/?param=en
I want to change the language through code.
If someone can solve this for me, I'll be real happy.
P.S. I'm using C#
Culture UICulture language Culture ASP.NET button a through using code change with
All-Star
194524 Points
28081 Posts
Moderator
Re: Changing language using buttons instead of drop down list
Dec 04, 2010 04:07 AM|Mikesdotnetting|LINK
Check the value of each button in the Initialize culture code to see if one was clicked.
Contributor
6087 Points
1704 Posts
Re: Changing language using buttons instead of drop down list
Dec 08, 2010 01:34 AM|sandy060583|LINK
Use Session variable, which can identify - In which culture the site is running.
So when u press button , in that click event of button change the session variable to that culture & based on Culture Session variable , you can set your culture using basepage or page init event..
Hope this will help !!!
Ramani Sandeep (My Blog)
(MCTS, MCC-2011)
Member
10 Points
46 Posts
Re: Changing language using buttons instead of drop down list
Jan 14, 2011 12:15 PM|Marquis_DeBlodey|LINK
All those worked. Thanks.
Member
10 Points
46 Posts
Re: Changing language using buttons instead of drop down list
Sep 01, 2011 05:57 PM|Marquis_DeBlodey|LINK
NOTE:
Ive come back to this thread to give one important feedback on what I've learned since I made multiligual sites.
If you want search engines to index all language versions of your site, you need to use the query string method.
If not, search engines will NOT index all languages on your site.
This is because search engines will only index an url once. So if a page is in french and english and both share the same url, withought a query string, you will only be able to index one version of that page.
With a query string, it is seen as a different page because it has a different url.
I put my french version with a lang=fr query string and put no query sting on english. This makes english my default language. All other languages have a query string.
If there is no query string, show the default language, if not, choose the language according to the "lang" query.
This solved my problem bieautifully. All my pages are now indexed.
engine search index