LA.NET [EN]

May 21

Dynamic data pages: exposing your data through RSS feeds

Posted in ASP.NET      Comments Off on Dynamic data pages: exposing your data through RSS feeds

The DynamicRssLink control generates a link that you can put in your page and that is responsible for initiating the automatic generation of an RSS feed that you may consume on your blog reader. By default, the control generates an Hyperlink control. Following the same principles explained here, you can customize its appearance (or event create a new Hyperlink control and associate it with the DynamicRssControl).

When you drop a DynamicRssLink control on a page, you”ll want to override the GetRssFields method that your page inherits from the DynamicDataPage base class. You”re supposed to return (at most) 2 column names that you want to show in your RSS feed. Again, you can follow the approaches presented here. The following example overrides this method and returns a simple column and a dynamic column (again, for the Students table):

public override IEnumerable GetRssFields ()
{
   return new object[] { 
      “StudentID”,
       new DynamicDataColumn( “Complete info”,
                                                 delegate{ 
                                                      return string.Concat( EvalS( “Name” ), ” – “, EvalS( “Address” ) );
                                                   } )
   };
}

If you subscribe the feed, do note that clicking on an item will send you back to the details view page of that table (which takes into account these aspects).