troubleshooting Question

CDATA dropdownlist binding

Avatar of stevesuch
stevesuch asked on
XMLMicrosoft ExcelASP.NET
5 Comments1 Solution719 ViewsLast Modified:
Hi, I'm trying to bind xml to a dropdownlist I have, but am having trouble setting the CDATA child element as the DataTextField:

The xml is as follows:

<?xml version="1.0" encoding="utf-16"?>
<content>
...
<contentblock id="OrderStatus">
  <contentitem id="0" type="1" local="True"><![CDATA[Cancelled]]></contentitem>
  <contentitem id="1" type="1" local="True"><![CDATA[Incomplete]]></contentitem>
</contentblock>
...
</content>

The controls read as follows:

<asp:XmlDataSource ID="XmlDataSource1" Runat="server" DataFile="App_Data\translations\en\global.xml"
            XPath="content/contentblock[@id ='OrderStatus']/contentitem">
        </asp:XmlDataSource>
        <asp:DropDownList runat="server" DataSourceID="XmlDataSource1" AutoPostBack="true" Width="90" ID="lstStatus" DataValueField="id"
            DataTextField="."></asp:DropDownList>

I've tried "/", "/text()", "CDATA" but they all return:
XmlDataSourceNodeDescriptor' does not contain a property with the name "." or whatever I try in DataTextField.
Any help would be greatly appeciated. Cheers
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros