On Whidbey...

G

Guest

Hi ,
I'm working with Whidbey...
I am trying to bind an XML to a DropDownList control. I wrote
something of this sort…


<asp:XmlDataSource ID="loader1" Runat="server" DataFile="island.xml"
XPath="Customers/customer/Customer">
</asp:XmlDataSource>

<asp:DropDownList ID="DropDownList1" Runat="server"
DataSourceID="loader1" DataTextField= "country" >

</asp:DropDownList>

This gives an error : DataBinding:
'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor' does not contain a
property with the name 'country'.


However the following works fine,

<asp:Repeater ID="Repeater1"
DataSourceID="loader1"
runat="server">
<ItemTemplate>
<h1><%# XPath ("country") %></h1>
</ItemTemplate>
</asp:Repeater>

So, I tried giving a similar XPath in DataTextField , but doesn’t recognize
it.
Any pointers...

Kicha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top