using System; using System.Collections.Generic; using System.Reflection; using System.Data; using System.Configuration; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using SyndicationFeed; using System.Collections.Specialized; using System.Collections.ObjectModel; namespace Iap.Controls { [ToolboxData("<{0}:FeedLinkCreator runat=\"server\">")] public class FeedLinkCreator : CompositeControl { internal Collection Links { get { if (ViewState["Links"] == null) { ViewState["Links"] = new Collection( ); } return (Collection)ViewState["Links"]; } set { ViewState["Links"] = value; } } public FeedLinkCreator( ) { } protected override void CreateChildControls( ) { if (this.Links.Count > 0) { foreach (RssFeed feed in this.Links) { HtmlGenericControl link = new HtmlGenericControl("div"); link.Attributes.Add("rel", "alternate"); link.Attributes.Add("type", "application/rss+xml"); link.Attributes.Add("href", feed.HRef); link.Attributes.Add("title", feed.Title); this.Controls.Add(link); } } else { this.Visible = false; } base.CreateChildControls( ); } } }