Asp.net 3.5中的实时板球计分卡 [英] Live Cricket Score Card in Asp.net 3.5

查看:62
本文介绍了Asp.net 3.5中的实时板球计分卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Web应用程序上显示实时板球记分卡.为了实现这一目标,我尝试从多个站点阅读RSS Feed,但它只会向我显示比赛细节,例如时间和比赛之间的国家/地区.

以下是aspx页面的代码

I want to show live cricket score card on my web application. for achieving this i tried to read the RSS Feed from several site but its only showing me the match detail like time and the country between the game will be played.

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);
            }
        }
    }


任何人都可以告诉我这种方法是否正确,或者可以帮助我提出一些建议.
谢谢


Can any one tell me whether this approach is right or help me with some suggestion.
Thanks

推荐答案

html问题....如何解决? ...
html problem....how to solve?.........................


阅读RSS feed是可以的.
因此,基本上,这种方法是可以的.

只是想知道,如果仍然有大量可用的应用程序,为什么要构建这样的应用程序.
Reading an RSS feed is ok.
So basically on the whole this approach is ok.

Just wondering, why do you want to build an application like this when there are tons of them available anyway.


这篇关于Asp.net 3.5中的实时板球计分卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆