0 comments

It's really easy - just use a repeater control:

<%@ Page Language="C#" ContentType="text/xml" MaintainScrollPositionOnPostback="false"
    AutoEventWireup="true" CodeBehind="NyheterRSS.aspx.cs" Inherits="NyheterRSS" %>

<%@ Import Namespace="mrfs" %>
<head id="Head1" runat="server" visible="false" />
<asp:sqldatasource runat="server" id="NewsDataSource" connectionstring="<%$ConnectionStrings:LocalSqlServer %>"
    selectcommand="SELECT id, title, abstract, text, publishdate, eventdate, aspnet_Users.UserName, archive                   
    FROM News                   
    LEFT JOIN aspnet_Users                   
    ON aspnet_Users.UserId = News.addedby                   
    WHERE archive='false' ORDER BY publishdate" />
<asp:repeater id="RssRepeater" runat="server" datasourceid="NewsDataSource">   
    <HeaderTemplate>      
        <rss version="2.0">         
        <channel>            
        <title><![CDATA[mrfs.se: Nyheter]]></title>            
        <link></link>            
        <description>Malmö Radioflygsällskaps Nyheter</description>            
        <copyright>Copyright 2006 Malmö Radioflygsällskap</copyright>    
    </HeaderTemplate>     
    <ItemTemplate>            
        <item>               
            <title><![CDATA[<%# Eval("title") %>]]></title>               
            <author><![CDATA[<%# Eval("addedby") %>]]></author>               
            <description><![CDATA[<%# Eval("text") %>]]></description>               
            <link></link>               
            <pubDate><%# string.Format("{0:R}", Eval("publishdate")) %></pubDate>            
        </item>   
    </ItemTemplate>    
    <FooterTemplate>         
        </channel>      
        </rss>    
    </FooterTemplate>
</asp:repeater>

It's as simple as that!

comments powered by Disqus