XmlDataSource and viewing data

  • Thread starter =?ISO-8859-1?Q?Arint=E9?=
  • Start date
?

=?ISO-8859-1?Q?Arint=E9?=

I have an xml that looks like this:
<miniblog xmlns:s="miniblog.xsd">
<Blog>
<Date>2007-10-10T12:00:00</Date>
<Diary>This is a journey into sound 10/10</Diary>
</Blog>
<Blog>
<Date>2007-10-03T12:00:00</Date>
<Diary>This is a journey into sound 10/9</Diary>
</Blog>
</miniblog>

in asp the datasource looks like this
<asp:XmlDataSource runat="server" ID="XMLBlogDS" DataFile="~/App_Data/miniblog.xml">
</asp:XmlDataSource>


I want the date info to show up in a TreeView on the left and I want the diary
info to show up in a text box or something on the right.

So currently, the treeview is bound to the xmldatasource, so when the user
clicks on of the dates (treenodes), it should display the diary info. How do I
get the diary info from the datasource, I don't see any method or property that
will give me that info.
 
G

Guest

Hi,

You can bind this xml like below to XMLDatasource and then bind it to the
Treeview control. This will show the diary below date item.

<?xml version="1.0" encoding="utf-8" ?>
<miniblog>
<blog>
<date id= "2007-10-10T12:00:00" >
<Diary
title= "This is a journey into sound 10/10"
></Diary>
</date>
</blog>
<blog>
<date id = "2007-10-03T12:00:00" >
<Diary
title= "This is a journey into sound 10/9"
></Diary>
</date>
</blog>
</miniblog>

To show the date and diary value, please add the following in the HTML page:

<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1"
ShowLines="True"
Style="z-index: 100; left: 207px; position: absolute; top: 192px">
<DataBindings>
<asp:TreeNodeBinding DataMember=date TextField=id />
<asp:TreeNodeBinding DataMember=Diary TextField=title />
</DataBindings>
</asp:TreeView>

Regards,
Manish
 
A

Arinté

I want the diary info to show in the textbox and I only want the date to
show in the treeview.
How would I do that?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top