From their origin, feeds were intended to be an abstraction from a template, allowing you to return lists, create printer friendly pages, and various other things, completely detached from the skin and without the overhead of the DNN page itself. In fact, a feed is called by loading /DesktopModules/XModPro/Feed.aspx, which you can see is it's own page. However, you may have noticed that when creating a feed, you use a control within the feed itself (i.e. <xmod:Feed>, <xmod:JsonFeed>). So the workhorse of a feed is in fact the feed control. That means you can inject this control directly in a template without using various feed loading methods.


The following is an example of using a feed directly within a <DetailTemplate> to return roles based on a user.

<xmod:Template UsePaging="True" Ajax="True">
  <ListDataSource CommandText="SELECT [UserId], [PortalId], [Username], [FirstName], [LastName] FROM vw_Users"/>
  <DetailDataSource CommandText="SELECT [UserId], [PortalId], [Username], [FirstName], [LastName], [DisplayName], [IsSuperUser], [Email], [VanityUrl], [AffiliateId], [IsDeleted], [RefreshRoles], [LastIPAddress], [UpdatePassword], [PasswordResetToken], [PasswordResetExpiration], [Authorised], [CreatedByUserId], [CreatedOnDate], [LastModifiedByUserId], [LastModifiedOnDate] FROM vw_Users WHERE [UserId] = @UserId">
    <Parameter Name="UserId" />
    <table class="table table-striped">
          <th>User Id</th>
          <th>Portal Id</th>
          <th>First Name</th>
          <th>Last Name</th>
            <xmod:DetailLink Text="Details">
              <Parameter Name="UserId" Value='[[UserId]]' />

        <dl class="dl dl-horizontal">
          <ListDataSource CommandText="SELECT * FROM dbo.vw_UserRoles WHERE UserId = @UserId">
            <Parameter Name="UserId" Value='[[UserID]]' DataType="Int32" />
        <xmod:ReturnLink CssClass="btn btn-default" Text="Go Back" />  

Feeds in Templates


Share your progress with your friends!