Solved

Create a PagedDataSource with an XMLDataSource

Posted on 2008-06-21
4
946 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

809 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