RE: XML DATA source DataSetDataSource DataMemeber

From: Rich (Rich_at_discussions.microsoft.com)
Date: 11/21/04


Date: Sun, 21 Nov 2004 15:25:07 -0800

I'm a little confused because I'm familiar with "DataSet" objects and also
"DataList" objects, which have a property named "DataSource", but I don't
think there's anything called a "DataSetDataSource".

I'm also not sure what you mean when you say that your XML file has DataSets
in it because I though a DataSet was a container for XML data, not the other
way around.

Be that as it may, I think part of the problem is that your DataSet has two
DataTables in it. One of them must be called "image" and the other one is
called "item". When binding the DataList, you set the DataSource property to
the DataSet and the DataMember to the name of one of those tables. But in
our own ways, we both seem to come to the conclusion that you can't bind to
two tables at onse.

Solutions? Here's two possibilities to research:

1) Construct a schema for your dataset that forces <image> and <item> to be
two columns within the same DataTable. Set DataSource to the DataSet and
DataMember to the name of that one table. You should be good to go.

2) Construct a new class that has at least two public peoperties, call them
"image" and "item". Write code that reads through the XML data (or the
dataset) and instantiates a series of these objects. Add each of these
objects to an ArrayList. Set the DataSource of your DataList to that
ArrayList. (ArrayLists implement IEnumerable. You can bind a DataList to
any object that implements IEnumerable.)

Good Luck
 

"mo" wrote:

> Hi,
>
> I have a DataSetDataSource populated from an XML datasource.
> DataMember is assigned to one of the datasets in the XML file. I have
> a DataList which is displaying the DataSetDataSource. Any idea on how
> to get the DataSetDataSource inlcude multiple datasets within the XML
> files?
>
> Here is the a part of XML file
>
> - <image>
> <title>Yahoo! News</title>
> <width>142</width>
> <height>18</height>
> <link>http://xxx.xxx.com/>
> </image>
> - <item>
> <title>xxxxxxxxxxxxxxxx</title>
> <pubDate>Fri, 19 Nov 2004 21:33:12 GMT</pubDate>
> </item>
>
> if I have my DataSetDataSource have "Item" or "image", my datalist
> display's the item. but I can not have my datalist to include both
> fields in the display.
> <ItemTemplate>
> <asp:HyperLink ID="HyperLink1" Runat="server"
> NavigateUrl='<%# Bind("link") %>' Text='<%# Bind("title")
> %>'></asp:HyperLink>
> </ItemTemplate>
> Any ideas is greatly appreciated.
>
> Thanks,
> Mo
>



Relevant Pages

  • DSO/XML Conversion Utility - Write permissions for member security cannot be set in cube role
    ... I built XML to replace an Analysis Services 2000 SP4 database using the ... I am ultimately just trying to change the cube's datasource (not just change ... have a development server and a production server, and I want to be able to ... copy AS objects like cubes from one to the other. ...
    (microsoft.public.sqlserver.olap)
  • Re: databind - XmlNodeList to DropDownList
    ... i would think that XPATH support would be a no-brainer for ... a .DataSource of XML. ... ..DataSource, then an index value for which to use as the ... Matt Del Vecchio ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Element Tree Help
    ... struggling to find a way to parse the details from the XML document ... defines a datasource with the key to the element being the 'name' which is ... defined in the XML and then the value of the pair is a tuple which contains ... documentation of element tree and have struggled to break the ice and parse ...
    (comp.lang.python)
  • OWC & XML datasource
    ... I am trying to generate a chart using XML as the datasource. ... if i have a datetime field, otherwise with other data types it works ...
    (microsoft.public.office.developer.web.components)
  • XML UTF8 header UTF16 Body
    ... If I select an XML data source and use and XSD to complete the datasource. ... XML Export and create an XML file of the data. ...
    (microsoft.public.excel)

Loading