473,796 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Windo ws-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.00000 0</qtyord>
<qtyshp>75.0000 00</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="Windo ws-1252"?>
<xs:schema attributeFormDe fault="unqualif ied" elementFormDefa ult="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VFPData">
<xs:complexType >
<xs:sequence>
<xs:element maxOccurs="unbo unded" 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:unsign edByte" />
<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:decima l" />
<xs:element name="qtyshp" type="xs:decima l" />
<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**@kacycreati ve.com
Nov 12 '05 #1
1 11803

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().Ma pPath("XMLfile. xml");
System.Data.Dat aSet ds_myusers = new
System.Data.Dat aSet("ds_myuser s");
ds_myusers.Read Xml(xmlFile);
GridView1.set_D ataSource(ds_my users);
GridView1.set_D ataMember("user ");
GridView1.DataB ind();

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
464
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: <?xml version = "1.0" encoding="Windows-1252" standalone="yes"?> <VFPData> <ac_sodata> <iono>Vendor</iono> <sodate>2004-03-04</sodate> <sono>164</sono>
2
3168
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 at i_am_the_freshmaka@hotmail.com
0
2335
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" /> <MENUITEM title="leafnode_2" visible="false" /> </MENU> <MENU title="subnode_2" visible="false"> <MENUITEM title="leafnode_3" visible="true" />
3
9170
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 really had any success. I'm pretty sure I should be casting my XPathSelect() call to something so I can get at its attributes. This seems like it should be easy, and maybe I'm missing something obvious. Does anyone have any ideas? Here is the...
2
2683
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 ID="XmlDataSource1" runat="server" DataFile="<% Session("UserPath") %"></asp:XmlDataSource> I have even tried this: <asp:XmlDataSource ID="XmlDataSource1" runat="server"
2
7458
by: sck10 | last post by:
Hello, How do you set the website proxy using the XmlDataSource control? Thanks, sck10
5
3095
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 and then update panel and some control in it to test it. When i run the programme ir does not work . imean ajax does not works
5
1232
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 bindable properties. Here's a sample of it: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <dealers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <dealer_item id="93"> <name>Auburn Harley Davidson</name>
1
7189
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 field. After using this, I couldnt see a column supporting hyperlink. In the gridviews first column header, there appears an hyperlink with the first record link displaying. That also only in header overwriting with the first column caption.
2
1212
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 html page? I just have <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/ my.xml"
0
9529
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10457
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6792
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4119
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2927
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.