Friday, 11 April 2008

Creating Updated google New Using Google Rss in show in datagrid

in aspx page u write

[sourcecode language="html"]
<asp:DataList id="myDataGrid" Width=200px runat=server>

<ItemTemplate><%#Eval("description") %></ItemTemplate>

</asp:DataList>

[/sourcecode]


in codebehind
[sourcecode language="csharp"]
protected void Page_Load(object sender, EventArgs e)
{myDataGrid.DataSource = RssFeed.getrssdata().Tables[3];
myDataGrid.DataBind();

}

[/sourcecode]




[sourcecode language="csharp"]
public class RssFeed{

public RssFeed(){}

public static DataSet getrssdata()

{XmlTextReader reader = new XmlTextReader("http://news.google.com/news?ned=in&output=rss");

DataSet ds = new DataSet();

ds.ReadXml(reader);

return ds;

}

}
[/sourcecode]
Share:

0 Comments:

Post a Comment