[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 953
  • Last Modified:

Create a PagedDataSource with an XMLDataSource

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
timbersnow
Asked:
timbersnow
  • 2
  • 2
1 Solution
 
kennethfineCommented:
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
 
kennethfineCommented:
0
 
timbersnowAuthor Commented:
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
 
timbersnowAuthor Commented:
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now