| | |
"Back" mess up Language Selection Code
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2006
Posts: 30
Reputation:
Solved Threads: 0
My site allow you to switch between 3 langauges.
At the time I created it, I still went with iFrames, and due to the size of the site now, very hard to go back and change everything.
All works fine, until the user start using that darn "BACK" and "FORWARD" buttoms. It seems the parent page, and the child pages respond different to the clicking of these buttons.
So, if the user changed his language, and then click "BACK", the "main" page will show in one language, and the child page in another.
I made 4 simple html pages with a javascript that control the iframe's source to demonstrate you my problem. Unzip demo.rar and run parent.html. [NO....CANNOT ATTACH HERE.....SEE SAMPLE CODE AT BOTTOM] Switch the language, and then use back....see?
Of course, in my asp.net pages it goes a bit deeper. Clicking the language buttons set this:
and I check the language in each page's (each of the about 20 child pages) load event.
But, once again, showing a page by clicking the back button, does not fire the load event at all...postback or de not. So it seems I got now way forcing the child page to check the parent's language when the Back and Next buttons are used.
ps: Noticed in firefox, clicking back and next does nothing. Better check in IE, will you?
At the time I created it, I still went with iFrames, and due to the size of the site now, very hard to go back and change everything.
All works fine, until the user start using that darn "BACK" and "FORWARD" buttoms. It seems the parent page, and the child pages respond different to the clicking of these buttons.
So, if the user changed his language, and then click "BACK", the "main" page will show in one language, and the child page in another.
I made 4 simple html pages with a javascript that control the iframe's source to demonstrate you my problem. Unzip demo.rar and run parent.html. [NO....CANNOT ATTACH HERE.....SEE SAMPLE CODE AT BOTTOM] Switch the language, and then use back....see?
Of course, in my asp.net pages it goes a bit deeper. Clicking the language buttons set this:
ASP.NET Syntax (Toggle Plain Text)
System.Web.HttpContext.Current.Response.Cookies["lang"].Value = lang; System.Web.HttpContext.Current.Response.Cookies["lang"].Expires = DateTime.Now .AddDays(360); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
But, once again, showing a page by clicking the back button, does not fire the load event at all...postback or de not. So it seems I got now way forcing the child page to check the parent's language when the Back and Next buttons are used.
ps: Noticed in firefox, clicking back and next does nothing. Better check in IE, will you?
ASP.NET Syntax (Toggle Plain Text)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <title></title> <script type="text/javascript"> function ChangeLang(lang) { topbox = document.getElementById("body"); topbox.src = lang + ".html"; if (lang=="en") document.getElementById("main").innerHTML = "The parent and child should show in <b>ENGLISH</b>"; else if (lang=="ja") document.getElementById("main").innerHTML = "The parent and child should show in <b>JAPANESE</b>"; else if (lang=="zh") document.getElementById("main").innerHTML = "The parent and child should show in <b>CHINESE</b>"; } </script> </head> <body> <table width="800"> <tr> <td align="left" id="main">The parent and child should show in <b>ENGLISH</b></td> <td align="right"> <a href="#" onclick="ChangeLang('en');">English</a> <a href="#" onclick="ChangeLang('ja');">Japanese</a> <a href="#" onclick="ChangeLang('zh');">Chinese</a> </td> <tr> <tr> <td colspan=2> <iframe src="en.html" name="body" id="body" width="800" > </iframe></td> </tr> </table> </body> </html>
If you want to use CSS to design Web sites you can't do it in a half-baked way. You are in or you're not in. - Charles Wyke-Smith
![]() |
Similar Threads
- I want to get started learning a programming language (Computer Science)
- learning php (PHP)
- Lookup tables - how to perform a switch using a string (C++)
- Selection.End(xlDown).Select (Visual Basic 4 / 5 / 6)
- another "segmentation fault" (C++)
- Scroll Bars for the [Code][/Code] Tagged Portion (DaniWeb Community Feedback)
- what is python (Python)
- Forum lurkers, introduce yourself ... !! (Community Introductions)
- i need code for binary to decimal (it should be written in 'C') (C)
Other Threads in the ASP.NET Forum
- Previous Thread: User Controls not showing up in Mozilla Firefox
- Next Thread: separate dropdownlist for dates
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu dynamically edit expose fill flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery listbox login menu microsoft mono mouse mssql multistepregistration news numerical objects opera order panelmasterpagebuttoncontrols radio ratings registration reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





