ASP.NET - live cricket score rss

Asked By chitra ganapathy
04-Aug-11 05:18 AM
the following link is the rss feed.
http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml,
i want to display the score in form
  Vickey F replied to chitra ganapathy
04-Aug-11 05:18 AM
As you told that your file in XML format.

Then Read that XML file by using ReadXML() method of DataSet.

After that bind this dataset to the GridView.

Like this-

 DataSet ds= New Dataset();
 ds.ReadXML("FilePath");

//Now bind this dataset to GridView.

 GridView1.DataSource=ds;
 GridView1.DataBind();


Try this and let me know.
  James H replied to chitra ganapathy
04-Aug-11 05:19 AM
HI PLEASE CHECK THIS LINK
http://www.eggheadcafe.com/community/aspnet/17/10341628/how-to-read-xml-file.aspx
  Ravi S replied to chitra ganapathy
04-Aug-11 05:21 AM
HI

refer this link

here are example

http://www.eggheadcafe.com/community/aspnet/17/10297938/yahoos-cricket.aspx
  Riley K replied to chitra ganapathy
04-Aug-11 05:28 AM
//grab the feed and bind it to a repeater control called rptRssFeed

protected void Page_Init(object sender, EventArgs e)
{
  XPathNavigator xpn = new XPathDocument(_feedUrl).CreateNavigator();
  _xmlnsm = XmlHelper.GetXmlNameSpaceManager(xpn);
 
  rptRssFeed.DataSource = xpn.Select("/x:rss/x:channel/x:item", _xmlnsm);
  rptRssFeed.DataBind();
}

//assign the feed values to controls within the repeater
protected void rptRssFeed_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
  if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
  {
  XPathNavigator xpn = (XPathNavigator)e.Item.DataItem;
  Literal litTitle = (Literal)e.Item.FindControl("litTitle");
  Literal litDescription = (Literal)e.Item.FindControl("litDescription");
  HyperLink hypLink1 = (HyperLink)e.Item.FindControl("hypLink1");
  HyperLink hypLink2 = (HyperLink)e.Item.FindControl("hypLink2");
 
  litTitle.Text = xpn.SelectSingleNode("x:title", _xmlnsm).Value;
  litDescription.Text = xpn.SelectSingleNode("x:description", _xmlnsm).Value;
  hypLink1.NavigateUrl = xpn.SelectSingleNode("x:link", _xmlnsm).Value;
  hypLink2.NavigateUrl = xpn.SelectSingleNode("x:link", _xmlnsm).Value;
  }
}
  Anoop S replied to chitra ganapathy
04-Aug-11 06:22 AM

The following code shows a complete ASP.NET Web page that will display the contents of an RSS feed in a DataGrid. Note that the code to load the RSS feed's XML content into a DataSet has been moved into a function, GetRSSFeed(), which returns the appropriate DataTable to bind to the DataGrid.

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<script language="VB" runat="server">
  Sub Page_Load(sender as Object, e as EventArgs)    
    recentPosts.DataSource = GetRSSFeed(RSS URL)
    recentPosts.DataBind()      
  End Sub


  Function GetRSSFeed(strURL as String) as DataTable
    'Get the XML data
    Dim reader as XmlTextReader = New XmlTextReader(strURL)
    
    'return a new DataSet
    Dim ds as DataSet = New DataSet()
    ds.ReadXml(reader)    
    Return ds.Tables(2)
  End Function
</script>

<asp:DataGrid runat="server" id="recentPosts" />
  dipa ahuja replied to chitra ganapathy
04-Aug-11 06:47 AM
You can use this way:

<object type="application/x-shockwave-flash" 
data="http://www.widgets.cricinfo.com/o/482c264908cd8b29/49ffff88c8333099/482c264908cd8b29/9769851d" 
id="W482c264908cd8b2949ffff88c8333099" 
width="300" height="250">
<param name="movie" value="http://www.widgets.cricinfo.com/o/482c264908cd8b29/49ffff88c8333099/482c264908cd8b29/9769851d" />
<param name="wmode" value="transparent" />
<param name="allowNetworking" value="all" />
<param name="allowScriptAccess" value="always" />
    
</object>
Or refer this links
http://www.eggheadcafe.com/community/aspnet/17/10270812/using-variables-from-some-other-website.aspx
http://www.codeproject.com/Questions/162920/Live-Cricket-Score-Card-in-Asp-net-3-5?display=Print
  Radhika roy replied to chitra ganapathy
04-Aug-11 12:48 PM

Certainly that's very diffcult to find a good idea will be to add a Widget by just pasting few lines of html code

from here

http://www.cricinfo.com/widgets/?addata=widget_hpnp

 

like this try pasting it

<object type="application/x-shockwave-flash" data="http://www.widgets.cricinfo.com/o/482c264908cd8b29/49ffff88c8333099/482c264908cd8b29/9769851d" id="W482c264908cd8b2949ffff88c8333099" width="300" height="250"><param name="movie" value="http://www.widgets.cricinfo.com/o/482c264908cd8b29/49ffff88c8333099/482c264908cd8b29/9769851d" /><param name="wmode" value="transparent" /><param name="allowNetworking" value="all" /><param name="allowScriptAccess" value="always" /></object>

Hope this will help you.

  Devil Scorpio replied to chitra ganapathy
04-Aug-11 04:08 PM
Hi,

Following is the code for aspx page
<div>
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <table class="NormalText" runat="server" id="tbl_Feed_Reader" cellpadding="0" cellspacing="0">
                    </table>
                </td>
            </tr>
        </table>
    </div>
in code behind :
public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RSSFeedService rssFeedSerice_obj = new RSSFeedService();
            ReadRssFeed();
        }
        public void ReadRssFeed()
        {
            string rssFeedUrl = "http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/cricket/rss.xml";
            WebRequest requestFeedfrmUrl = WebRequest.Create(rssFeedUrl);
            WebResponse responseFeedfrmUrl = requestFeedfrmUrl.GetResponse();
            Stream streamRssFedd = responseFeedfrmUrl.GetResponseStream();
            XmlDocument scoreRssFeed = new XmlDocument();
            scoreRssFeed.Load(streamRssFedd);
            XmlNodeList scoreNode = scoreRssFeed.SelectNodes("rss/channel/item");
            string sTitle = "";
            string sLink = "";
            string sDescription = "";
            //iterate through node list
            for (int i = 0; i < scoreNode.Count; i++)
            {
                XmlNode scoreRSSDetail;
                scoreRSSDetail = scoreNode.Item(i).SelectSingleNode("title");
                if (scoreRSSDetail != null)
                {
                    sTitle = scoreRSSDetail.InnerText;
                }
                else
                {
                    sTitle = "";
                }
                scoreRSSDetail = scoreNode.Item(i).SelectSingleNode("link");
                if (scoreRSSDetail != null)
                {
                    sLink = scoreRSSDetail.InnerText;
                }
                else
                {
                    sLink = "";
                }
                scoreRSSDetail = scoreNode.Item(i).SelectSingleNode("description");
                if (scoreRSSDetail != null)
                {
                    sDescription = scoreRSSDetail.InnerText;
                }
                else
                {
                    sDescription = "";
                }
                //generate HTML table
                HtmlTableCell block = new HtmlTableCell();
                block.InnerHtml = "<span style='font-weight:bold'><a href='" + sLink + "' target='new'>" + sTitle + "</a></span>";
                HtmlTableRow row = new HtmlTableRow();
                row.Cells.Add(block);
                tbl_Feed_Reader.Rows.Add(row);
                HtmlTableCell block_description = new HtmlTableCell();
                block_description.InnerHtml = "<p align='justify'>" + sDescription + "</p>";
                HtmlTableRow row2 = new HtmlTableRow();
                row2.Cells.Add(block_description);
                tbl_Feed_Reader.Rows.Add(row2);
            }
        }
    }
Create New Account
help
not be 100% correct sub void Customers1_ItemDataBound(Object sender, RepeaterItemEvenArgs e) { if (e.Item.ItemType = ListItemType.Item) | | (e.Item.ItemType = ListItemType.AlternatingItem) { / / This is to look for the Customers2 repeater that is nested inside the Customers1 in the Customers2_ItemDataBound() event sub void Customers2_ItemDataBound(Object sender, RepeaterItemEvenArgs e) { if (e.Item.ItemType = ListItemType.Item) | | (e.Item.ItemType = ListItemType.AlternatingItem) { / / This is to look for the Customers3 repeater that is nested inside the Customers2 code accordingly if you include the nested Repeaters in the <SeperatorTemplate> if (e.Item.ItemType = ListItemType.Item) | | (e.Item.ItemType = ListItemType.AlternatingItem) { / / This is to look for the Customers2 repeater that is nested inside the Customers1 sender, RepeaterItemEvenArgs e) { / / NOTICE: and this line of code as well if (e.Item.ItemType = ListItemType.Item) | | (e.Item.ItemType = ListItemType.AlternatingItem) { / / This is to look for the Customers3 repeater that is nested inside the Customers2
DateTime(); DateTime datecnt = new DateTime(); int tRows; int tCells; for (tRows = 0; tRows < 3; tRows++) { HtmlTableRow dTRow = new HtmlTableRow(); if (tRows = = 0) { HtmlTableRow dTRow1 = new HtmlTableRow(); HtmlTable tbl = new HtmlTable(); tbl.Rows.Add(dTRow1); / / HtmlTableCell dTCell = new HtmlTableCell(); / / dTCell.InnerText = "Date"; / / dTRow1.Controls.Add(dTCell); int year = Convert.ToInt16(drpyear.Text); int month DateTime.DaysInMonth(year, month); DateTime newDate = new DateTime(); for (int i = 0; i <8; i++) { HtmlTableCell dTCell = new HtmlTableCell(); if (i = = 0) { dTCell.InnerText = "Date"; dTRow.Controls.Add(dTCell); } else { / / HtmlTableCell dTCell1 = new HtmlTableCell
PopulateDataTable(); / / add templated fields to the GridView TemplateField BtnTmpField = new TemplateField(); BtnTmpField.ItemTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.Item, ". . .", "Command"); BtnTmpField.HeaderTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.EditItem, ". . .", "Command"); TableGridView.Columns.Add(BtnTmpField); for (int i = 0; i < Table.Columns.Count; i TemplateField ItemTmpField = new TemplateField(); / / create HeaderTemplate ItemTmpField.HeaderTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.Header, Table.Columns[i].ColumnName, Table.Columns[i].DataType.Name); / / create ItemTemplate ItemTmpField.ItemTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.Item, Table.Columns[i].ColumnName, Table.Columns[i].DataType.Name); / / create EditItemTemplate / / then add to DataSource = Table; TableGridView.DataBind(); } } [B]and in the class file[ / B] public class DynamicallyTemplatedGridViewHandler : ITemplate { ListItemType ItemType; string FieldName; string InfoType; public DynamicallyTemplatedGridViewHandler(ListItemType item_type, string field_name, string info_type) { ItemType = item_type; FieldName = field_name; InfoType = info_type; } public void InstantiateIn(System Web.UI.Control Container) { switch (ItemType) { case ListItemType.Header: Literal header_ltrl = new Literal(); header_ltrl.Text = "<b> " + FieldName + "< / b> "; Container.Controls.Add(header_ltrl); break; case ListItemType.Item: switch (InfoType) { case "Command": break; default: Label field_lbl = new Label(); field_lbl.ID = FieldName; field_lbl
runat = "server"> < / div> In the button click event place the code HtmlTable table = new HtmlTable(); HtmlTableRow row1 = new HtmlTableRow(); HtmlTableCell cell1 = new HtmlTableCell(); HtmlTableCell cell2 = new HtmlTableCell(); HtmlTableCell cell3 = new HtmlTableCell(); row1.Cells.Add(cell1); / / Add cells to row1 row1.Cells.Add(cell2); row1.Cells.Add