Last post May 05, 2008 10:16 AM by nolazabal
Apr 28, 2008 04:28 PM|nolazabal|LINK
Hello, I have been having some problem using sitemaps and localization
I have based my example on this MS sample
I can see how this works if in my page I play with uiculture="" option, now my problem is that I can get it to change on demand.
I have created a BasePage calss based on this sample
now all elements on my page do work fone execpt my menu that is based in the sitemap. Only if I force the page using the uiculture option the lenguage will change.
Any ideas on this?
Apr 30, 2008 06:20 AM|nbop|LINK
It would help if you posted your code but just a quick question.
are you storing your sitemap resource files in App_GlobalResources or App_LocalResources....they should be stored in App_GlobalResources or they wont work...
if this is not the issue you will have to post you code....
let me know if it helped.
Apr 30, 2008 10:00 AM|nolazabal|LINK
well the code is there, not using any special thing other than the one on the samples
i found a way around it but not sure is good, since the menu uses a sitemap data provider i have to re-bind the data on every postback now i dont think that is a good idea, what i have done so far is create a session variable that will tell me if the culture
was changed then only re-bind on that moment. something like this in the load event of my page.
If IsPostBack Then
If Session("CultureChanged") IsNot
if anyone else has a better ide pls let me know
May 04, 2008 05:57 PM|nbop|LINK
ok doing it with sessions would not be my recommendation...I do it using cookies so I have my language settings left when i revisit the website.
this is how I solved it on one of my websites using a dropdown menu for selecting language:
page_load I do the binding for the dropdown...
If Not (Page.IsPostBack) Then
MainNavigationMenu.DataSource = Data.GetCultureList()
MainNavigationMenu.SelectedValue = Request.Cookies("Culture")("name")
and then I use autopostback= true attribute for the dropdown and it works as bellow
Protected Sub MainNavigationMenu_SelectedIndexChanged(ByVal sender
As Object, ByVal e
As System.EventArgs) Handles MainNavigationMenu.SelectedIndexChanged
Response.Cookies("Culture")("name") = MainNavigationMenu.SelectedValue
of course you dont need to use autopostback = true you can have a button to trigger the event but well this is how I have solved it and it works great.
let me know if this solved the problem...
May 05, 2008 10:16 AM|nolazabal|LINK
ty for the response, i figure session is not the best way i coud try the cookies since i keep the cookie anyways for when the user return to the site