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 ChoudharyPosted Aug 5, 2011, 3:50 AM
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.
chitraPosted Sep 19, 2011, 5:13 AM
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();
}
}
chitraPosted Aug 27, 2011, 12:35 AM
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.
Sam HobbsPosted Aug 26, 2011, 3:22 PM
chitraPosted Aug 26, 2011, 3:49 AM
<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...
Amit ChoudharyPosted Aug 8, 2011, 6:24 AM
The Eval() function will bind the properties you have created in Linq to individual labels.
chitraPosted Aug 8, 2011, 2:52 AM
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
chitraPosted Aug 6, 2011, 1:06 AM
Sam HobbsPosted Aug 5, 2011, 5:40 PM
Amit ChoudharyPosted Aug 5, 2011, 1:10 PM
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...
chitraPosted Aug 5, 2011, 5:58 AM
chitraPosted Aug 5, 2011, 3:03 AM
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.
Dinesh BeniwalPosted Aug 5, 2011, 1:59 AM
If amit's answer solved your query then Mark as Acceped Answer.
Thanks
chitraPosted Aug 5, 2011, 1:56 AM
Amit ChoudharyPosted Aug 4, 2011, 9:03 AM
use below code:
Output:
live scores: ZIM 191/2 (60.0 ovs)
Hope this was helpful.