473,388 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

ASP.NET 2.0: problem using xmlDataSource and GridView...

I am having trouble using XML in an ASP.NET 2.0 webform. Using ASP.NET 2.0
beta 2, I have created a blank web page in a C# website. I have added an
XML file (soData.xml), structured as follows:

<?xml version = "1.0" encoding="Windows-1252" standalone="yes"?>
<VFPData>
<ac_sodata>
<iono>Vendor</iono>
<sodate>2004-03-04</sodate>
<sono>164</sono>
<custno>ADG1</custno>
<item>HD10.0G</item>
<descrip>10.0 GB EIDE Ultra DMA 9.0ms Hard Disk Drive</descrip>
<qtyord>0.000000</qtyord>
<qtyshp>75.000000</qtyshp>
<rqdate>2004-03-04</rqdate>
</ac_sodata>
</VFPData>
When I drag an xmlDataSource from the toolbox to the page in Design mode, I
get the following error dialog box:

The operation could not be completed. Unspecified error.

However, if I drag the xmlDataSource from the toolbar onto the page in
Source mode, there is no error. I am able to go into xmlDataSource Tasks
and configure the data file to ~/soData.xml.

Then when I drag a GridView from the toolbox to the page (in either Design
or Source mode), no error is generated. But when I use the GridView Tasks to
set the data source to xmlDataSource1, the GridView box on the page says:

There was an error rendering the control. The data source for the GridView
with id 'GridView1' did not have any properties or attributes from which to
generate columns. Ensure that your data source has content.

I have generated a schema for the XML file, but that doesn't seem to help.
Here is the layout of the .XSD file:

<?xml version="1.0" encoding="Windows-1252"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VFPData">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="ac_sodata">
<xs:complexType>
<xs:sequence>
<xs:element name="iono" type="xs:string" />
<xs:element name="sodate" type="xs:date" />
<xs:element name="sono" type="xs:unsignedByte" />
<xs:element name="custno" type="xs:string" />
<xs:element name="item" type="xs:string" />
<xs:element name="descrip" type="xs:string" />
<xs:element name="qtyord" type="xs:decimal" />
<xs:element name="qtyshp" type="xs:decimal" />
<xs:element name="rqdate" type="xs:date" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Any help would be greatly appreciated!

Will Kacy
wi**@kacycreative.com
Nov 12 '05 #1
1 11772

I've experienced the same problem and do not know the answer. However,
I've found a couple of workarounds.

Your XML-file contains textnodes and if you change your XML file format
and use attributes instead, it works.

Example:

<users>
<user name="Peter" address="City"></user>
</users>

instead of

<users>
<user>
<name>Peter</name>
<address>City</address>
</user>
</users>

If you don't want to change the XML-file you can make it work if you
write code instead of using the XmlDataSource control:

System.String xmlFile = get_Server().MapPath("XMLfile.xml");
System.Data.DataSet ds_myusers = new
System.Data.DataSet("ds_myusers");
ds_myusers.ReadXml(xmlFile);
GridView1.set_DataSource(ds_myusers);
GridView1.set_DataMember("user");
GridView1.DataBind();

It doesn't answer your question though. I believe it's a bug.

SteenNielsen
--
SteenNielsen
------------------------------------------------------------------------
SteenNielsen's Profile: http://www.hightechtalks.com/m80
View this thread: http://www.hightechtalks.com/t2251064

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: W. Kacy | last post by:
I am having trouble using XML in an ASP.NET 2.0 webform. Using ASP.NET 2.0 beta 2, I have created a blank web page in a C# website. I have added an XML file (soData.xml), structured as follows: ...
2
by: mike | last post by:
can somebody please show me some code that will let me populate a checkboxlist from the xmldatasource, and have the text property set to the names in the xml file thanks you can also email me...
0
by: Kurt Kubein | last post by:
Hi, I have this xmldoc linked to a xmldatasource in .Net 2.0 <MENUROOT title="Home" visible="true"> <MENU title="subnode_1" visible="true"> <MENUITEM title="leafnode_1" visible="true" />...
3
by: Brian | last post by:
Using external XML, I'm trying to build a quiz, but I can't seem to specify the DataSource for the RadioButtonList within a Repeater ItemTemplate. I've tried a number of approaches, but I haven't...
2
by: Zulander | last post by:
hi, i am trying to put a session variable in the DataFile of the XmlDataSource, but for some reason i am getting: Server tags cannot contain <% ... %constructs. <asp:XmlDataSource...
2
by: sck10 | last post by:
Hello, How do you set the website proxy using the XmlDataSource control? Thanks, sck10
5
by: Mukesh | last post by:
Hi i want to use AJAX.net in my Existing Application I have already installed the ajax .net ..net 3.0 and using VS 2005 in the old application i have added a new web form then script manager...
5
by: ky0t3 | last post by:
I'm trying to add XML to my my ASP.NET project and have it read by the gridview control or even the telerik radgrid control either way, it doesn't work. I get an error about not finding and...
1
by: Valli | last post by:
Hi, I need to display an hyperlink column in gridview where if the user clicks that column the page should move to the selected page. I have got help from this group & started using template...
2
by: mazdotnet | last post by:
Hi all, I have trying to test an XML file with a XSLT file. However, I don't know how to dump the content (generate page to the screen). What control do I need to bind to display the generate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.