Groups | Blog | Home
all groups > dotnet xml > february 2006 >

dotnet xml : Datalist with an xml file



Aaron
2/19/2006 9:55:13 PM
How do I get all the name(s) listed in the datalist?

<asp:DataList ID=3D"DataList1" runat=3D"server" =
DataSourceID=3D"XmlDataSource1">

<ItemTemplate>

<table>

<tr>

<td><%# XPath("Name")%></td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

<asp:XmlDataSource ID=3D"XmlDataSource1" runat=3D"server" =
DataFile=3D"~/Query1.xml" XPath=3D"Donors">

</asp:XmlDataSource>

<Donors>

<Name >

Abigail Sears

</Name>

<Name >

Alicia &amp; Joe Swindel

</Name>

<Name >

Alissa &amp; Neal Keny-Guyer

</Name>

<Name >

Ann Bremer &amp; Earl Molander

</Name>

....

Aaron
2/20/2006 9:34:15 AM
Martin,

Thanks,

my next question is this:
How do you get this datalist more like a grided table of 3 columns?
Here is what I have but it is not in true columns.
<asp:DataList ID="DataList1" runat="server" BorderColor="#006699"
DataSourceID="XmlDataSource1"

GridLines="Both" ShowFooter="False" ShowHeader="False" BackColor="White"
Font-Bold="False" Font-Italic="False" Font-Overline="False"
Font-Strikeout="False" Font-Underline="False" RepeatColumns="3"
RepeatDirection="Horizontal">

<ItemTemplate><%# XPath(".")%></ItemTemplate>

</asp:DataList>

Aaron Minoo
[quoted text, click to view]

Martin Honnen
2/20/2006 3:50:49 PM


[quoted text, click to view]

This is one way to do it (.NET 2.0):

<asp:XmlDataSource
ID="XmlDataSource1"
runat="server"
DataFile="test2006022001.xml" XPath="Donors/Name"></asp:XmlDataSource>

<asp:DataList id="MyDataList" DataSourceId="XmlDataSource1" runat="server">
<ItemTemplate>
<%# XPath(".") %>
</ItemTemplate>
</asp:DataList>


--

Martin Honnen --- MVP XML
Martin Honnen
2/20/2006 7:00:51 PM

[quoted text, click to view]

The XML specific problem is solved then I think, for presentational
aspects of the ASP.NET DataList consider asking in an ASP.NET group.

--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button