Last post Apr 28, 2006 06:11 AM by shadowcaster
Jan 30, 2006 11:29 AM|ctellez69|LINK
I have a simple page with a treeview, a menu and a sitemappath controls along with a select-language listbox:
In the code-behind page we have the following:
UICulture = Request.Form(ls)
Culture = Request.Form(ls)
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage)
Thread.CurrentThread.CurrentUICulture = New CultureInfo(selectedLanguage)
When I select the Spanish language the only control that changes to Spanish is the SiteMapPath, but the SiteMapData-bounded controls (treeview and menu) keep in English.
I've been trying to figure out what's wrong but cannot make them work. Any idea?
Jan 31, 2006 10:03 AM|ctellez69|LINK
It was driving me crazy but I finally got it! The point is that treeview, and menu (and others) are data-bound controls. So You have to update them when you need their contents to change, in this case whe you select another language.
So finally you only have to "re-bind" the control to its data source. You cannot do it in the InitializaCulture sub because the controls aren't still created yet. What I did was to put it in the load method of the form and voila! Everything is working terrific!
Hope this help others.
Apr 28, 2006 06:11 AM|shadowcaster|LINK
What did you do?
I realise this post is a bit old but I'm facing the following situation and it is also "driving me crazy".
I have a menu control on a master page and want to switch language through implict localization (i.e. browser setting). I don't want to do this through ItemDataBound.
The control is link to a sitemap datasource and the xml has enableLocalization="true" and a resourceKey="xxx" in each siteMapNode. Furthermore, to be sure both the sitemap control and menu control call their DataBind method on page load. Still no luck.
Any help would be appreciated.