Wriju's BLOG

.NET, Cloud and everything

ASP.NET 3.5 ListView and DataPager : Making RSS Reader

ASP.NET 3.5 comes with bundle of new data bound controls. Among them ListView and DataPager are the ones I am going talk here. To me ListView is the enhanced from of DataRepeater. It has got everything you might need to create an app with your HTML/CSS skill set. Today you often visit blogs and you subscribe to RSS feed for your favourite ones. Here we are going to create the sample on “How to create RSS Reader”.

Ø  Create a simple ASP.NET Project/Website.

Ø  Add “XmlDataSource” to your page.

Ø  Add the below configuration to your “XmlDataSource” for this blog,







Note that the XPath is unique for any RSS feed and that is the standard.

Ø  Now you need to add the ListView Control with below configuration






This “ItemPlaceholderID” is the key here. You must need to have “asp:PlaceHolder” control under “LayoutTemplate” to be able to bind the data properly.


Ø  Now let us have a look how the “LayoutTemplate” looks like



    <br /><br /><h1> Wriju’s Recent Blog</h1><br /><br />

    <asp:PlaceHolder ID=”itemPlaceholder




Here we have exact same ID for PlaceHolder


Ø  Now how the individual records would look like, it is by ItemTemplate



    <h2><asp:HyperLink ID=”hpLink”

            runat=”server” Target=”_blank” 

            NavigateUrl=’<%# XPath(“link”) %>

        ><%# XPath(“title”) %></asp:HyperLink>


    <p><em>Published <%# XPath(“pubDate”) %></em></p>

    <p><%# XPath(“description”) %></p>



Ø  Last one is optional if you need i.e.,  ItemSeparatorTemplate



    <hr />



Ø  And now if you need the paging just go ahead and add DataPager control to it.

<asp:DataPager ID=”DataPager1″






        <asp:NextPreviousPagerField ButtonType=”Button”

            ShowFirstPageButton=”true” ShowLastPageButton=”true”

            ShowNextPageButton=”true” ShowPreviousPageButton=”true” />                

         <asp:NumericPagerField     />                   



Only thing you need to have here for a DataPager to say, “this is your paged control” though the attribute/property “listWrijuBlog”. This is nothing but your ListView control’s ID.

The source file is attached here.

For more visit http://asp.net