473,748 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is my control not populated with XML data?

I have created two DropDownList controls on my form which I want to
populate with data from an XML file (stored in the xml subdirectory)

Here is the code I use.

It does not work. I shows "System.Data.Da taRowView" in both the value
and text fields of the DropDownLists

In debug, I noticed that:
ds.Tables["date"].Rows.Count = 20
dds.Tables["date"].DefaultView.Co unt = 20

There are 20 items in the xml file.

Furthermore, when I add a watch for "ds.Tables["date"].DefaultView", I
can click on "Data View Visuliser" (in debug again) and it shows the
table information (20 rows, 2 columns each).

What else do I need to do to load this xml data into my controls?

1) code:

DataSet ds = new DataSet();
ds.ReadXml(@".. \xml\dates.xml" );

ddlFromDate.Dat aSource = ds.Tables["date"].DefaultView;
ddlFromDate.Dat aBind();
ddlToDate.DataS ource = ds.Tables["date"].DefaultView;
ddlToDate.DataB ind();

2) xml file: dates.xml

<?xml version="1.0"?>
<dates>
<date>
<dateValue>2002 1</dateValue>
<dateText>200 2 1st Qtr</dateText>
</date>
<date>
<dateValue>2002 2</dateValue>
<dateText>200 2 2nd Qtr</dateText>
</date>
<date>
<dateValue>2002 3</dateValue>
<dateText>200 2 3rd Qtr</dateText>
</date>
<date>
<dateValue>2002 4</dateValue>
<dateText>200 2 4th Qtr</dateText>
</date>
<date>
<dateValue>2003 1</dateValue>
<dateText>200 3 1st Qtr</dateText>
</date>
<date>
<dateValue>2003 2</dateValue>
<dateText>200 3 2nd Qtr</dateText>
</date>
<date>
<dateValue>2003 3</dateValue>
<dateText>200 3 3rd Qtr</dateText>
</date>
<date>
<dateValue>2003 4</dateValue>
<dateText>200 3 4th Qtr</dateText>
</date>
<date>
<dateValue>2004 1</dateValue>
<dateText>200 4 1st Qtr</dateText>
</date>
<date>
<dateValue>2004 2</dateValue>
<dateText>200 4 2nd Qtr</dateText>
</date>
<date>
<dateValue>2004 3</dateValue>
<dateText>200 4 3rd Qtr</dateText>
</date>
<date>
<dateValue>2004 4</dateValue>
<dateText>200 4 4th Qtr</dateText>
</date>
<date>
<dateValue>2005 1</dateValue>
<dateText>200 5 1st Qtr</dateText>
</date>
<date>
<dateValue>2005 2</dateValue>
<dateText>200 5 2nd Qtr</dateText>
</date>
<date>
<dateValue>2005 3</dateValue>
<dateText>200 5 3rd Qtr</dateText>
</date>
<date>
<dateValue>2005 4</dateValue>
<dateText>200 5 4th Qtr</dateText>
</date>
<date>
<dateValue>2006 1</dateValue>
<dateText>200 6 1st Qtr</dateText>
</date>
<date>
<dateValue>2006 2</dateValue>
<dateText>200 6 2nd Qtr</dateText>
</date>
<date>
<dateValue>2006 3</dateValue>
<dateText>200 6 3rd Qtr</dateText>
</date>
<date>
<dateValue>2006 4</dateValue>
<dateText>200 6 4th Qtr</dateText>
</date>
</dates>

3) xsd file: dates.xsd

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="dates">
<xs:complexType >
<xs:sequence>
<xs:element name="date">
<xs:complexType >
<xs:sequence>
<xs:element name="dateItem" maxOccurs="unbo unded">
<xs:complexType >
<xs:sequence>
<xs:element name="dateCode" type="xs:intege r"/>
<xs:element name="dateText" type="xs:string "/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Dec 19 '06 #1
0 1010

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

Similar topics

0
1123
by: saira tst via .NET 247 | last post by:
(Type your message here) -------------------------------- From: saira tst hi, I have created a data grid control and populated the control,from an array list. The grid contains a column with check boxcontrol. I am able to trace the click of the check box controlthru the data grid clicked event,datagrid cell changed event.now i want to trace the number of items that had been checked inthe grid and on click of a button add that lies...
3
1892
by: Henke | last post by:
How can data be passed to the server when an event is fired in client-side jscript, ie on a drop event? I have tried using hidden fields and submitting the page, but for some reason I can't access a html hidden field that is set to run as server control. Please can someone point me in the right direction here? /Henke
2
3626
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
1454
by: Fred Morrison | last post by:
1. No Columns collection. 2. No ability to easily synchronize the underlying DataTable of a DataGrid when a row is deleted in the Grid. Once you sort (via the column headers) all bets are off as to whether the current row index of the data grid can be used directly as the Rows index of the DataTable. This is documented in the DataGrid Overview. 3. No way to access the default grid table style to make minor changes to just one column...
2
2779
by: Fred Flintstone | last post by:
I'm creating a multi-column dropdown since there isn't one. My idea is to override an Infragistics Combo and add the dropdown as a grid object. So I create a basic override of the control. The first thing I want the control to do is kill the default button and add a new one. So in the initialization (New) area of the control I add the code to do that: Me.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never Dim...
12
1344
by: NuB | last post by:
The validation controls are giving me a headache. here is what i'm trying to do and so far what I've tried has not worked. I need to hide my grid if the page is not valid how can i accomplish that? I have one validation control that gives an error if there is no data returned, so if the page is not valid on another search i need that to go away. How can i hide and show controls and labels bases on the page.isvalid
3
2492
by: Carlos Lozano | last post by:
Hello, I am having a problem getting the selectedValue from a dropdownlist that is populated with a dataReader and just can't see the problem. I did the following: dim dr as DataReader dr = DataReader(sSQLcmd) Me.DropDownList1.DataSource = dr
2
1616
by: dorrit.Riemenschneider | last post by:
Hi, I develop a sharepoint webpart with ASP.Net 2.0 and therefore override CreateChildControls(). In CreateChildControls() I create dynamically a menu with items (and sub items) from a database. Let's say after the first loading I have 5 menu items. My problem: Every time the page is loaded (that means also if a menu item is clicked) the menu items are doubled (I have 10, 15, 20, ... menu items).
2
1657
by: NerdyGirL | last post by:
Hello, I've read thru numerous post/archives trying to decipher the cause of my problem to no avail. I'm just basically trying to conduct a search by using a form in order to locate data that may or may not be in one field of an associated table/query. Here's my 3-step process. 1) I click on the name of my Main form (that I've already created along with a subform and query and an click-on command button) and it prompts me with an "Enter...
1
1695
by: KMEscherich | last post by:
Platform = Windows Program = Access 2003 Hi there, I am stumpped!! I am attempting to populate a form control as follows: I have a form that has 2 drop-down boxes. One retrieves the EMP_ID and the 2nd one retrieves the EMP_NAME and EMP_ID.
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
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
9541
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
9370
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
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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
6074
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
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.