To write the Rss Contents from list/datatable.
steps to follow:
Get the all the item (ex: news in a list/datatable loop through the items bind in the rss feeds format)
refer the attached image.
image 1
image 2
C#Code:
protected void Page_Load(object sender, EventArgs e)
{
this.Context.Response.ContentType = "text/xml";
this.Context.Response.ContentEncoding = Encoding.UTF8;
ShowHeader(this.Context);
NewsManager newsManager = new Telerik.News.NewsManager("News");
IList listOfNewsItems = newsManager.Content.GetContent();
if (listOfNewsItems.Count > 0)
{
foreach (IContent ICntNews in listOfNewsItems)
{
DateTime strPDate = Convert.ToDateTime(ICntNews.GetMetaData("Publication_Date"));
if (strPDate < DateTime.Now)
{
ShowItem(this.Context, ICntNews);
}
}
}
ShowFooter(this.Context);
}
private void ShowItem(HttpContext context, Telerik.Cms.Engine.IContent content)
{
context.Response.Write("
context.Response.Write(string.Format("
DateTime dtPubdate = Convert.ToDateTime(content.GetMetaData("Publication_Date"));
context.Response.Write(string.Format("
context.Response.Write(string.Format("
context.Response.Write(string.Format("{0}://{1}{2}", context.Request.Url.Scheme, context.Request.Url.Authority, ConfigurationManager.AppSettings["NewsDetails"].ToString() + "?sNewsID=" + content.ID));
context.Response.Write(string.Format("
context.Response.Write("
}
private void ShowHeader(HttpContext context)
{
context.Response.Write("");
context.Response.Write("
context.Response.Write("
context.Response.Write("
context.Response.Write("
context.Response.Write("http://www.qfc.com.qa/ ");
context.Response.Write("
context.Response.Write(Environment.NewLine);
}
private void ShowFooter(HttpContext context)
{
context.Response.Write("
context.Response.Write("
}
ஏஞ்சல்
என்னை பற்றி
Google reader
Categories
- .Net (9)
- .Net Crystal Report (1)
- .Net GridView (3)
- Articles (5)
- Log File .Net (1)
- Sharepoint (2)
- Sitefinity 3.7 (3)
- SQL (5)
- Technical Question and Ans (3)
- Validation (1)
- XML (2)
Monday, July 27, 2009
Rss Feeds in asp.net
When hearts listen
angel sing.If you seek an angel with an open heart...
You shall always find loved one