Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.Net menu databinding encoding problem
    primarykey
    data
    text
    <p>I have a menu where I bind data through:</p> <pre><code>XmlDataSource xmlData = new XmlDataSource(); xmlData.DataFile = String.Format(@"{0}{1}\Navigation.xml", getXmlPath(), getLanguage()); xmlData.XPath = @"/Items/Item"; TopNavigation.DataSource = xmlData; TopNavigation.DataBind(); </code></pre> <p>The problem is when my xml has special characters, since I use a lot of french words.</p> <p>As an alternative I tried using a stream instead and using encoding to get the special characters, with the following code:</p> <pre><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(); </code></pre> <p>The problem I'm having now is that my data doesn't refresh when I change the path where the stream gets read.</p> <p>When I skip through the code it does, but not on my page.</p> <p>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?</p> <p>Help is highly apreciated!</p> <p>EDIT:</p> <p>I tried the CDATA solution, however i'm working with attributes so it's not possible to specify an element in an attribute, my xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;Items Text=""&gt; &lt;Item Text="Actualités&gt;"/&gt; &lt;Item Text="Matériau"&gt; &lt;Item Text="Arsenal"/&gt; &lt;Item Text="Vêtements"/&gt; &lt;/Item&gt; &lt;Item Text="Links"/&gt; &lt;/Items&gt; </code></pre> <p>Any other ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload