A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Languages
»
Other Languages
Author
XML binding to <asp:dropdownlist> declaratively
sasank manohar
Ranch Hand
Joined: Feb 14, 2008
Posts: 186
posted
Oct 06, 2010 01:32:10
0
I have an xml file like
//StateXml.xml <?xml version="1.0" encoding="utf-8" ?> <States> <State> <ID>1</ID> <Name>State Name1</Name> </State> <State> <ID>2</ID> <Name>State Name2</Name> <State> <ID>3</ID> <Name>State Name3</Name> </State> <State> <ID>4</ID> <Name>State Name4</Name> </State> <State> <ID>5</ID> <Name>State Name5</Name> </State> </State> </States>
and an aspx file like
//StateDDL.aspx
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>State</title> </head> <body> <form id="form1" runat="server"> <asp:XmlDataSource runat="server" id="StateXmlDS" XPath="/States/State" DataFile="StateXml.xml" /> <asp:DropDownList runat="server" ID="DropDownListID" AppendDataBoundItems="true" DataSourceID="StateXmlDS" DataTextField="Name" DataValueField="ID"> <asp:ListItem Text="--select--" Value="1" /> </asp:DropDownList> </form>
both these files are in C:\Inetpub\wwwroot
so when i am compiling the aspx page , i am getting an error like this
DataBinding: 'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor' does not contain a property with the name 'Name'.
so what could be the problem?
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32827
4
posted
Oct 06, 2010 04:05:14
0
Sounds like a question which would get better attention in our XML forum> moving.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32827
4
posted
Oct 06, 2010 10:13:43
0
I earlier wrote:
Sounds like a question which would get better attention in our XML forum> moving.
. . . and somebody says it would have been better back in "other languages". Sorry
It will appear in two places now, and I shall move it back.
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: XML binding to <asp:dropdownlist> declaratively
Similar Threads
Need help with Jquery
project file structure for web application (war).
Opening a webpage in same window using javascript without anchor tag
How to get to the custom tags on a page from a scriptlet?
Read data to the xml file from the database?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter