473,321 Members | 1,916 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,321 software developers and data experts.

XmlDataSource or DataSetDataSource

I have a code below i'm trying to test
It had a DataSetDatasource but i thinks its deprecated if yes what can i use
in this scenario below?
I used XmlDatasource but its saying it can't find the property url in the
xml which is there

Any ideas?
** XML datasource file below


<asp:XmlDataSource ID="DataSetDataSource1" Runat="server"
DataFile="~/data/Announcements.xml"/>

<asp:DataList ID="DataList1" Runat="server"
DataSourceID="DataSetDataSource1">

<ItemTemplate>

<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">

<tr>

<td valign="top" style="width: 80%">

<asp:HyperLink ID="TitleLabel" Runat="server" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem, "url") %>'

Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>'
Font-Names="verdana"

Font-Bold="True" Font-Size="8pt" ForeColor="#003399" />

<br />

by

<asp:Label ID="OwnerLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Owner") %>'

ForeColor="#003399" />

</td>

<td style="text-align: right" align="right" valign="top">

<asp:Label ID="DateLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Date") %>'

Font-Names="verdana" Font-Bold="True" Font-Size="8pt" ForeColor="#003399" />

</td>

</tr>
<tr>

<td colspan="2">

<asp:Label ID="DescriptionLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Description") %>' />

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

----------------------------------------------

<?xml version="1.0" encoding="utf-8" ?>

<announcements>

<announcement>

<id>1</id>

<title>New Intranet Portal Launched!</title>

<date>6/1/2003</date>

<owner>Star Developer</owner>

<description>Our new Company Intranet Portal has launched! Be sure to check
out the ultra cool personalization abilities.</description>

<url>~/sales.aspx</url>

</announcement>

<announcement>

<id>2</id>

<title>Top Customers Identified</title>

<date>6/1/2003</date>

<owner>Sales Manager</owner>

<description>We have identified our top customers based on orders placed.
Check out the Sales tab for more details.</description>

<url>~/default.aspx</url>

</announcement>

<announcement>

<id>3</id>

<title>Pay Day</title>

<date>5/15/2003</date>

<owner>President</owner>

<description>We have decided to double eveyone's paycheck this month.
Enjoy!</description>

<url>~/default.aspx</url>

</announcement>

</announcements>


May 21 '07 #1
2 1817
On May 21, 10:27 am, "rote" <naijaco...@hotmail.comwrote:
I have a code below i'm trying to test
It had a DataSetDatasource but i thinks its deprecated if yes what can i use
in this scenario below?
I used XmlDatasource but its saying it can't find the property url in the
xml which is there

Any ideas?
** XML datasource file below

<asp:XmlDataSource ID="DataSetDataSource1" Runat="server"
DataFile="~/data/Announcements.xml"/>

<asp:DataList ID="DataList1" Runat="server"
DataSourceID="DataSetDataSource1">

<ItemTemplate>

<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">

<tr>

<td valign="top" style="width: 80%">

<asp:HyperLink ID="TitleLabel" Runat="server" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem, "url") %>'

Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>'
Font-Names="verdana"

Font-Bold="True" Font-Size="8pt" ForeColor="#003399" />

<br />

by

<asp:Label ID="OwnerLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Owner") %>'

ForeColor="#003399" />

</td>

<td style="text-align: right" align="right" valign="top">

<asp:Label ID="DateLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Date") %>'

Font-Names="verdana" Font-Bold="True" Font-Size="8pt" ForeColor="#003399" />

</td>

</tr>

<tr>

<td colspan="2">

<asp:Label ID="DescriptionLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Description") %>' />

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

----------------------------------------------

<?xml version="1.0" encoding="utf-8" ?>

<announcements>

<announcement>

<id>1</id>

<title>New Intranet Portal Launched!</title>

<date>6/1/2003</date>

<owner>Star Developer</owner>

<description>Our new Company Intranet Portal has launched! Be sure to check
out the ultra cool personalization abilities.</description>

<url>~/sales.aspx</url>

</announcement>

<announcement>

<id>2</id>

<title>Top Customers Identified</title>

<date>6/1/2003</date>

<owner>Sales Manager</owner>

<description>We have identified our top customers based on orders placed.
Check out the Sales tab for more details.</description>

<url>~/default.aspx</url>

</announcement>

<announcement>

<id>3</id>

<title>Pay Day</title>

<date>5/15/2003</date>

<owner>President</owner>

<description>We have decided to double eveyone's paycheck this month.
Enjoy!</description>

<url>~/default.aspx</url>

</announcement>

</announcements>
This should work

<asp:XmlDataSource ID="DataSetDataSource1" Runat="server"
DataFile="~/data/Announcements.xml" XPath="announcements/
announcement" />

<asp:DataList ID="DataList1" runat="server"
DataSourceID="DataSetDataSource1">
<ItemTemplate>
<table id="Table1" cellspacing="1" cellpadding="1"
width="100%" border="0">
<tr>
<td valign="top" style="width: 80%">
<asp:HyperLink ID="TitleLabel"
runat="server" NavigateUrl='<%# XPath("url") %>' Text='<%#
XPath("title") %>' Font-Names="verdana"
Font-Bold="True" Font-Size="8pt"
ForeColor="#003399" />
<br />
by
<asp:Label ID="OwnerLabel"
runat="server" Text='<%# XPath("owner") %>' ForeColor="#003399" />
</td>
<td style="text-align: right"
align="right" valign="top">
<asp:Label ID="DateLabel"
runat="server" Text='<%# XPath("date") %>' Font-Names="verdana" Font-
Bold="True" Font-Size="8pt" ForeColor="#003399" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="DescriptionLabel"
runat="server" Text='<%# XPath("description") %>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>

May 21 '07 #2
Thanks alot
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
On May 21, 10:27 am, "rote" <naijaco...@hotmail.comwrote:
>I have a code below i'm trying to test
It had a DataSetDatasource but i thinks its deprecated if yes what can i
use
in this scenario below?
I used XmlDatasource but its saying it can't find the property url in the
xml which is there

Any ideas?
** XML datasource file below

<asp:XmlDataSource ID="DataSetDataSource1" Runat="server"
DataFile="~/data/Announcements.xml"/>

<asp:DataList ID="DataList1" Runat="server"
DataSourceID="DataSetDataSource1">

<ItemTemplate>

<table id="Table1" cellspacing="1" cellpadding="1" width="100%"
border="0">

<tr>

<td valign="top" style="width: 80%">

<asp:HyperLink ID="TitleLabel" Runat="server" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem, "url") %>'

Text='<%# DataBinder.Eval(Container.DataItem, "Title") %>'
Font-Names="verdana"

Font-Bold="True" Font-Size="8pt" ForeColor="#003399" />

<br />

by

<asp:Label ID="OwnerLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Owner") %>'

ForeColor="#003399" />

</td>

<td style="text-align: right" align="right" valign="top">

<asp:Label ID="DateLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Date") %>'

Font-Names="verdana" Font-Bold="True" Font-Size="8pt" ForeColor="#003399"
/>

</td>

</tr>

<tr>

<td colspan="2">

<asp:Label ID="DescriptionLabel" Runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Description") %>' />

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

----------------------------------------------

<?xml version="1.0" encoding="utf-8" ?>

<announcements>

<announcement>

<id>1</id>

<title>New Intranet Portal Launched!</title>

<date>6/1/2003</date>

<owner>Star Developer</owner>

<description>Our new Company Intranet Portal has launched! Be sure to
check
out the ultra cool personalization abilities.</description>

<url>~/sales.aspx</url>

</announcement>

<announcement>

<id>2</id>

<title>Top Customers Identified</title>

<date>6/1/2003</date>

<owner>Sales Manager</owner>

<description>We have identified our top customers based on orders placed.
Check out the Sales tab for more details.</description>

<url>~/default.aspx</url>

</announcement>

<announcement>

<id>3</id>

<title>Pay Day</title>

<date>5/15/2003</date>

<owner>President</owner>

<description>We have decided to double eveyone's paycheck this month.
Enjoy!</description>

<url>~/default.aspx</url>

</announcement>

</announcements>

This should work

<asp:XmlDataSource ID="DataSetDataSource1" Runat="server"
DataFile="~/data/Announcements.xml" XPath="announcements/
announcement" />

<asp:DataList ID="DataList1" runat="server"
DataSourceID="DataSetDataSource1">
<ItemTemplate>
<table id="Table1" cellspacing="1" cellpadding="1"
width="100%" border="0">
<tr>
<td valign="top" style="width: 80%">
<asp:HyperLink ID="TitleLabel"
runat="server" NavigateUrl='<%# XPath("url") %>' Text='<%#
XPath("title") %>' Font-Names="verdana"
Font-Bold="True" Font-Size="8pt"
ForeColor="#003399" />
<br />
by
<asp:Label ID="OwnerLabel"
runat="server" Text='<%# XPath("owner") %>' ForeColor="#003399" />
</td>
<td style="text-align: right"
align="right" valign="top">
<asp:Label ID="DateLabel"
runat="server" Text='<%# XPath("date") %>' Font-Names="verdana" Font-
Bold="True" Font-Size="8pt" ForeColor="#003399" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="DescriptionLabel"
runat="server" Text='<%# XPath("description") %>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>

May 22 '07 #3

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...
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
1
by: Disccooker | last post by:
i am trying to use XPath and the XMLDataSource to display data from an XMLDocument and am getting nowhere. What i would like to do is have a repeater display a label for Seed, label for Team Name...
0
by: pompair | last post by:
Hello, I'm making a quiz game for fun. I have an xml file like this: <?xml version="1.0" encoding="utf-8" ?> <results> <index>99</index> <answers>11</answers> <questions> <question id="1">
8
by: Wessel Troost | last post by:
We are using an XML data source in the Page_Load event of an ASP.NET page, like: protected void Page_Load(object sender, EventArgs e) { // Retrieve XML from web service for product idea in URL...
1
by: Sean | last post by:
I am experiencing a strange problem using the XMLDataSource and DataList controls which I cannot seem to resolve. I am using the controls to read and display a variety of RSS feeds. On my local...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.