Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

In my application i have used the RSS feed. i have used the following code



XML
<div class="news-blog">
            <h4>
                News and events<div class="news_scroll">
                    <asp:LinkButton ID="btnDown" runat="server" onclick="btnDown_Click"></asp:LinkButton>

                    <asp:LinkButton ID="btnUp" runat="server" onclick="btnUp_Click"></asp:LinkButton>
                    </div>
            </h4>
            <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://www.gatesfoundation.org/FileReturn.aspx?returntype=rss&feed=all"
                XPath="rss/channel/item [position()<=3]"></asp:XmlDataSource>

            <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">
                <ItemTemplate>
                    <div class="news-events">

                        <table width="100%">
                            <tr>

                                <td>
                                    <div class="news-content">
                                        <h5>

                                    <asp:HyperLink ID="hypTitle" runat="server" Width="500px" Text='<%# XPath("title") %>'
                                        Target="_self" NavigateUrl='<%#XPath("link")%>'></asp:HyperLink>
                                </h5> </div><br />
                                <p>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="Label1" runat="server" Text='<%# XPath("description") %>'
                                        Style="float: right"></asp:Label>
                                </p>
                                </td>
                            </tr>

                        </table>
                        <br />
                    </div>
                </ItemTemplate>
            </asp:DataList>







from this i have shown the 3 news. but when i click on up button i want to the news from 2nd to 4th.in code behind i don't understand how can i change the positions of the news. i want just like XmlDataSource1.XPath = "rss/channel/item [position()<=3 && position()!=1]"; but it gives error. please help me.
Posted
Updated 18-Nov-12 20:10pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900