0

单击获取按钮时,我必须比较每个项目元素的标题,如果它与 ddlTitle 中选择的项目相同,并在标签 lbldesc 中显示子元素

但是,当我从下拉列表中选择标题后单击按钮时,描述不会出现

  protected void BtnGet_Click(object sender, EventArgs e)
    {
        XmlNodeList itemsList = RSSDoc.GetElementsByTagName("item");//get a list of item node
        if (itemsList.Count > 0)
        {
            foreach (XmlNode eachItem in itemsList) //for each item node
            {
                XmlNodeList itemNode = eachItem.ChildNodes;
                foreach (XmlNode itemchild in itemNode)     //Access title node
                {
                    if (itemchild.Name == "title")
                    {
                        lbldesc.Text = (itemchild.ChildNodes[3].InnerText);
                    }
                }
            }

        }
    }
4

0 回答 0