Solved

Create a PagedDataSource with an XMLDataSource

Posted on 2008-06-21
4
939 Views
Last Modified: 2013-11-06
I want to create a pageddatasouce for an xml file ... here is the logic:

GalImages.xml looks like:

<?xml version="1.0"?>
<gallery>
  <album lgPath="\images\gallery\disney08\Family\" tnPath="\images\gallery\disney08\Family\" title="Family" description="Family" tn="\images\gallery\disney08\Family\APL  001.jpg">
    <img src="APL  001.jpg" title="APL  001.jpg" caption="APL  001.jpg" link="" target="_blank" pause="" />
    <img src="APL  020.jpg" title="APL  020.jpg" caption="APL  020.jpg" link="" target="_blank" pause="" />
  </album>
</gallery>

code behind:
        Dim XMLSource As New DataSet
        XMLSource.ReadXml(MapPath("~/images/gallery/fincher/GalImages.xml"))
        Dim objPds As New PagedDataSource()
        objPds.DataSource = XMLSource.Tables(0).DefaultView
        objPds.AllowPaging = True
        objPds.PageSize = 5
        objPds.CurrentPageIndex = CurrentPage
        xmlRepeat.DataSource = objPds
       'xmlRepeat.DataBind()

ASPX:
             <asp:Repeater ID="xmlRepeat" runat="server" >
                    <ItemTemplate>
                        <div class="blues" style="width:275px;height:320px;float:left;text-align:center;">
                            <%#Eval("src")%>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>

When i run it i get:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'src'.

How do i expose the src in the xml.

If i use a XMLDataSource with an XPATH="/gallery/album/img"  it works - but no paging

Thanks,

Gp.





0
Comment
Question by:timbersnow
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:kennethfine
ID: 21839517
Is there a reason why you're not using the ASP.NET 3.5 DataPager and ListView controls? It will save you the pain of implementing paging yourself, and you can work with a richer and more capable control than the simple Repeater. See here:
http://aspnet.4guysfromrolla.com/articles/021308-1.aspx
0
 
LVL 6

Accepted Solution

by:
kennethfine earned 500 total points
ID: 21839541
0
 

Author Comment

by:timbersnow
ID: 21840885
Dude - you rock.  I've not worked with ListView - and I've heard everybody screamin' about it - now i know why.

This was EXACTLY what i needed - especially the article.

Thank you.

BTW ... you probably could answer my other question i posted yesterday - would you mind taking a look at http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23504543.html?cid=473

Thank you so much!

Cheers,

Gp.
0
 

Author Closing Comment

by:timbersnow
ID: 31469412
Dude - you rock.  I've not worked with ListView - and I've heard everybody screamin' about it - now i know why.

This was EXACTLY what i needed - especially the article.

Thank you.

BTW ... you probably could answer my other question i posted yesterday - would you mind taking a look at http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23504543.html?cid=473

Thank you so much!

Cheers,

Gp.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now