Hi sir,
I want to display the live cricket score in my web application, the following link gives the score
http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml
I want to display this score in labels r any gridview control.
plz help me...
Loading

Amit ChoudharyRank #145 · 15.8K reputationPosted Aug 4, 2011, 11:50 PM EDT
if you want the very first item then change the Linq query to
or if you want to show all the matches information then take a data control and bind it by selecting all the records. Remove the FirstOrDefault() all elements would get selected. moreover you can specify the new type in select of linq:
like this:
Bind these properties to the data control.
Note: Take care of data in each element of original XML file it should be in correct form.
Hope this was helpful.
Amit ChoudharyRank #145 · 15.8K reputationPosted Aug 4, 2011, 5:03 AM EDT
use below code:
Output:
live scores: ZIM 191/2 (60.0 ovs)
Hope this was helpful.
chitra33 reputationPosted Aug 4, 2011, 9:56 PM EDT
Dinesh BeniwalRank #9 · 64K reputationPosted Aug 4, 2011, 9:59 PM EDT
If amit's answer solved your query then Mark as Acceped Answer.
Thanks
chitra33 reputationPosted Aug 4, 2011, 11:03 PM EDT
public void getscoress()
{
XmlDocument xml = new XmlDocument();
xml.LoadXml("http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml"); // suppose that myXmlString contains "
XmlNodeList xnList = xml.SelectNodes("/matches/match");
foreach (XmlNode xn in xnList)
{
string score = xn["header"].InnerText;
string des = xn["description"].InnerText;
Console.WriteLine("score: {0} {1}", score, des);
}
},
it shows the error like this Data at the root level is invalid. Line 1, position 1.
chitra33 reputationPosted Aug 5, 2011, 1:58 AM EDT
Amit ChoudharyRank #145 · 15.8K reputationPosted Aug 5, 2011, 9:10 AM EDT
For your learning i suggest you to read the latest articles in this site.. this is your site, search it, explore it, learn it and don't forget to say thanks to authors.
These days in .Net LINQ is something every developer should good at it.
List the items you want to learn and start reading and do some sample project even small ones.
LINQ (includes Anonymous types, Lambda expressions, Extensions methods, Var keyword, Initializers etc. )
LINQ to Objects
LINQ to XML
LINQ to SQL (this is sort of outdated but learning it will be addon as you will know wat's new in Entities which was not in Linq to Sql)
LINQ to Entities
Prepare your self...
Sam HobbsRank #107 · 20.5K reputationPosted Aug 5, 2011, 1:40 PM EDT
chitra33 reputationPosted Aug 5, 2011, 9:06 PM EDT
chitra33 reputationPosted Aug 7, 2011, 10:52 PM EDT
i used the following query
var xml2 = from s3 in hell.Descendants("match") select (new{
Label3 = s3.Element("team1").Value,
Label4 = s3.Element("team2").Value,
Label5=s3.Element("series").Value
});
and bind it to repeater
Repeater2.DataSource = xml2;
Repeater2.DataBind();
my output is
Amit ChoudharyRank #145 · 15.8K reputationPosted Aug 8, 2011, 2:24 AM EDT
The Eval() function will bind the properties you have created in Linq to individual labels.
chitra33 reputationPosted Aug 25, 2011, 11:49 PM EDT
<matches>
<match id="20110825-ireeng">
its a rss xml file, so changes occurs oftenly. some times both child have the same elements.
my need is i want to display it dynamically. please help me...
Sam HobbsRank #107 · 20.5K reputationPosted Aug 26, 2011, 11:22 AM EDT
chitra33 reputationPosted Aug 26, 2011, 8:35 PM EDT
http://synd.cricbuzz.com/ashwl/scores-multi.xml and http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml
from this link i am getting live score.
chitra33 reputationPosted Sep 19, 2011, 1:13 AM EDT
i used the following query, but it shows me the error. plz help wer i made a mistake
public void fixtures()
{
XElement fixture = null;
try
{
fixture = XElement.Load("http://synd.cricbuzz.com/onmobile-togo/schedule-internal.xml");
}
catch
{
}
if (fixture != null)
{
var fix = from futu in fixture.Descendants("togoText")
select (new{
tit = futu.Element("title").Value,
par = futu.Element("p").Value
});
Repeater1.DataSource = fix;
Repeater1.DataBind();
}
}