Hi,
I have a menu where I bind data through:
XmlDataSource xmlData = new XmlDataSource();
xmlData.DataFile = String.Format(@"{0}{1}\Navigation.xml", getXmlPath(), getLanguage());
xmlData.XPath = @"/Items/Item";
TopNavigation.DataSource = xmlData;
TopNavigation.DataBind();
The problem is when my xml has special characters, since I use a lot of french words.
As an alternative I tried using a stream instead and using encoding to get the special characters, with the following code:
StreamReader strm = new StreamReader(String.Format(@"{0}{1}\Navigation.xml", getXmlPath(), getLanguage()), Encoding.GetEncoding(1254));
XmlDocument xDoc = new XmlDocument();
xDoc.Load(strm);
XmlDataSource xmlData = new XmlDataSource();
xmlData.ID = "TopNav";
xmlData.Data = xDoc.InnerXml;
xmlData.XPath = @"/Items/Item";
TopNavigation.Items.Clear();
TopNavigation.DataSource = xmlData;
TopNavigation.DataBind();
The problem I'm having now is that my data doesn't refresh when I change the path where the stream gets read.
When I skip through the code it does, but not on my page.
So the thing is either, how do I get the data te be refreshed? Or (which is actually preferred) how do I get the encoding right in the first piece of code?
Help is highly apreciated!