Friday, January 28, 2011

ASP.net: XMLDataSource can only bind with DropDownList when the values are used as attributes.

If you want to bind a DropDownList with an XMLDataSource and your xml has the following structure:

<destination>

<location><>assets_UploadedFile1</location>

<location>assets_UploadedFile2</location>

<location>assets_UploadedFile3</location>

</destination>


Actually, you can't bind. You have to modify your xml file as to conform to the following format:

<destination>

<location name="assets_UploadedFile1">

<location name="assets_UploadedFile2">

<location name="assets_UploadedFile3">

</location>


Now you can easily bind the DropDownList to the XMLData Source by selection xPath="destination/location" .

No comments:

Post a Comment