I think this is 2 problems but I'll add them both here. Firstable I have a working sitemap and I have created resource files for english and swedish, main site language is finnish. All work fine on that part.
My problem is that I'd like change the site language when user clicks the flag of what language he wants. I have created BasePage.cs to App_Code and it looks like this:
Code:
public class BasePage : System.Web.UI.Page {
protected override void InitializeCulture() {
int kohta = Request.RawUrl.LastIndexOf("lang=");
string culture;
if (kohta >= 0) {
culture = Request.RawUrl.Substring(kohta + 5, 2);
this.Culture = culture;
this.UICulture = culture;
}
else {
culture = "fi";
this.Culture = culture;
this.UICulture = culture;
}
}
}
I have links on my flags that have ?lang=en etc. on their attributes. Do you have a better idea on how to make the language changable? This code has probably some errors still so I'm open for suggestions.
Second problem I have with sitemap and how to present it. I'd like it to show up on a one-row table that has 5 cells with background image. I've now tried to find a way for this too long and almost found one but it's not working :(
I had this code in my navigation bar:
Code:
<table border="0" id="linkkitaulu">
<tr>
<asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1">
<ItemTemplate>
<td class="linkit">
<asp:HyperLink runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
</td>
<asp:Repeater runat="server" DataSourceID="<%# ((SiteMapNode) Container.DataItem).ChildNodes %>">
<ItemTemplate>
<td class="linkit">
<asp:HyperLink runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
</td>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</tr>
</table>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
The problem is the DataSourceID="<%# ((SiteMapNode) Container.DataItem).ChildNodes %> point, I just get errors when I'm trying to run the webpage. The code is from here:
http://aspnet.4guysfromrolla.com/articles/030806-1.aspx but I just can't get it working.
I'd really appreciate if you could help it. Takes a lot of time to change from PHP to ASP.net.