Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 20th, 2006, 05:55 AM
Aaron
Guest
 
Posts: n/a
Default Datalist with an xml file

How do I get all the name(s) listed in the datalist?

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

<ItemTemplate>

<table>

<tr>

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

</tr>

</table>

</ItemTemplate>

</asp:DataList>

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Query1.xml" XPath="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>

....

</Donors>

  #2  
Old February 20th, 2006, 03:05 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Datalist with an xml file



Aaron wrote:
[color=blue]
> How do I get all the name(s) listed in the datalist?[/color]
[color=blue]
> <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>
>
> ...
>
> </Donors>[/color]

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
http://JavaScript.FAQTs.com/
  #3  
Old February 20th, 2006, 05:35 PM
Aaron
Guest
 
Posts: n/a
Default Re: Datalist with an xml file

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
"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:eDIIO0iNGHA.3944@tk2msftngp13.phx.gbl...[color=blue]
>
>
> Aaron wrote:
>[color=green]
> > How do I get all the name(s) listed in the datalist?[/color]
>[color=green]
> > <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>
> >
> > ...
> >
> > </Donors>[/color]
>
> 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"[/color]
runat="server">[color=blue]
> <ItemTemplate>
> <%# XPath(".") %>
> </ItemTemplate>
> </asp:DataList>
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/[/color]


  #4  
Old February 20th, 2006, 06:15 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Datalist with an xml file


Aaron wrote:
[color=blue]
> my next question is this:
> How do you get this datalist more like a grided table of 3 columns?[/color]

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
http://JavaScript.FAQTs.com/
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles