Hi,
I've used a part of the code from the RSSFeed Live demo in my own web user control.
When the RSS source isn't available the RSS reader fails.
How can I handle errors in loading the RSS feed so it won't make the application crash, and also, how can I set the text for the prev and next buttons from code behind?
Thanks.
/Thomas
I've used a part of the code from the RSSFeed Live demo in my own web user control.
When the RSS source isn't available the RSS reader fails.
How can I handle errors in loading the RSS feed so it won't make the application crash, and also, how can I set the text for the prev and next buttons from code behind?
Thanks.
/Thomas
<
telerik:RadListView
ID
=
"RadListView1"
runat
=
"server"
OnNeedDataSource
=
"RadListView1_NeedDataSource"
AllowPaging
=
"true"
ItemPlaceholderID
=
"Panel1"
PageSize
=
"3"
>
<
LayoutTemplate
>
<
div
class
=
"layoutWrapper"
>
<
div
class
=
"rssHeaderWrapper"
title
=
"Copyright, 2011 Honda Motor Co., Ltd. and its subsidiaries and affiliates. All Rights Reserved."
>
<
div
class
=
"rssSubHeader"
>
honda world news
</
div
>
<
div
class
=
"rssHeader"
>
rss <
span
class
=
"rssHeadingDate"
>
<%# DateTime.Now.ToLongDateString().ToLower() %></
span
>
</
div
>
</
div
>
<
br
/>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
>
</
asp:Panel
>
<
div
style
=
"width: 100%; text-align: center;"
>
<
asp:ImageButton
ID
=
"PrevBtn"
runat
=
"server"
CommandName
=
"Page"
CommandArgument
=
"Prev"
AlternateText
=
"<"
CssClass
=
"rssButtons"
ImageUrl
=
"images/iconPrev.png"
/>
<
asp:ImageButton
ID
=
"RefreshBtn"
runat
=
"server"
CommandName
=
"Rebind"
AlternateText
=
"Refresh"
CssClass
=
"rssButtons"
ImageUrl
=
"images/iconRefresh.png"
/>
<
asp:ImageButton
ID
=
"NextBtn"
runat
=
"server"
CommandName
=
"Page"
CommandArgument
=
"Next"
AlternateText=">" CssClass="rssButtons" ImageUrl="images/iconNext.png" />
</
div
>
</
div
>
</
LayoutTemplate
>
<
ItemTemplate
>
<
table
class
=
"rssTable"
title='Item <%# (Container as RadListViewDataItem).DataItemIndex %>, Page <%# RadListView1.CurrentPageIndex + 1 %>'
style="vertical-align: top;">
<
tr
>
<
td
>
</
td
>
<
td
colspan
=
"2"
>
<
div
class
=
"rssTitle"
>
<
img
src
=
"images/iconRSS.png"
alt
=
"rss"
/>
<
a
href='<%# (Container.DataItem as XmlNode)["link"].InnerText %>' class="qsfSubtitle">
<%# (Container.DataItem as XmlNode)["title"].InnerText %>
</
a
>
</
div
>
<
div
class
=
"rssDate"
>
<%# (Container.DataItem as XmlNode)["pubDate"].InnerText %>
</
div
>
</
td
>
</
tr
>
<
tr
>
<
td
>
</
td
>
<
td
>
<
img
style
=
"border: solid 1px #999"
src='<%# (Container.DataItem as XmlNode)["hww:photo"].InnerText %>'
alt='<%# (Container.DataItem as XmlNode)["title"].InnerText %>' />
</
td
>
<
td
>
<
img
src='<%# (Container.DataItem as XmlNode)["hww:flag"].InnerText %>' alt='<%# (Container.DataItem as XmlNode)["hww:flag"].InnerText %>' />
<
span
class
=
"rssDescription"
>
<%# (Container.DataItem as XmlNode)["description"].InnerText %></
span
>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadListView
>