ASP.NET Datalist Control from RSS feed
spyderwebsvcs
Registered Users Posts: 4 Beginner grinner
Greetings I am new to developing for SmugMug, but not to ASP.NET. Currently I have a client who wants a website with a gallery page that is fed from her smug mug account. Using her current gallery feed I have compiled this code below. But it is not working any ideas?
ASPX page:
<asp:XmlDataSource ID="reliveSmugMug" runat="server" XPath="rss/channel/item" />
<asp:DataList ID="relivePhotos" runat="server" RepeatColumns="6">
<ItemTemplate>
<a href="<%# XPath("link").ToString() %>">
<asp:Image ID="img" ImageUrl='<%# XPath("guid") %>' runat="server" /></a>
</ItemTemplate>
</asp:DataList>
<asp:Label ID="Errorlbl" Visible="false" runat="server" />
Backend Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim rssURL As String
rssURL = "http://www.smugmug.com/hack/feed.mg?Type=nickname&Data=relivethemoments&format=rss200"
Try
reliveSmugMug.DataFile = rssURL
relivePhotos.DataSource = reliveSmugMug
relivePhotos.DataBind()
Catch err As XmlException
Errorlbl.Text = "An error occured with this gallery: " + err.Message
Errorlbl.Visible = True
End Try
End Sub
ASPX page:
<asp:XmlDataSource ID="reliveSmugMug" runat="server" XPath="rss/channel/item" />
<asp:DataList ID="relivePhotos" runat="server" RepeatColumns="6">
<ItemTemplate>
<a href="<%# XPath("link").ToString() %>">
<asp:Image ID="img" ImageUrl='<%# XPath("guid") %>' runat="server" /></a>
</ItemTemplate>
</asp:DataList>
<asp:Label ID="Errorlbl" Visible="false" runat="server" />
Backend Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim rssURL As String
rssURL = "http://www.smugmug.com/hack/feed.mg?Type=nickname&Data=relivethemoments&format=rss200"
Try
reliveSmugMug.DataFile = rssURL
relivePhotos.DataSource = reliveSmugMug
relivePhotos.DataBind()
Catch err As XmlException
Errorlbl.Text = "An error occured with this gallery: " + err.Message
Errorlbl.Visible = True
End Try
End Sub
0