0

Need help guys.. I need to separate all labels from aspx & aspx.cs file to XML file but I getting this error

Compiler Error Message: CS0029: Cannot implicitly convert type 'System.Xml.XmlNodeList' to 'string'

here is my xml file

<?xml version="1.0" encoding="iso-8859-1"?>
<labels>
	<btn>Update</btn>
</labels>

and here is my aspx.cs file

using System;
using System.Xml;

	XmlDocument lblDocument = new XmlDocument();
	lblDocument.Load(Server.MapPath("label.xml"));
			
            SaveBtn.Text = lblDocument.GetElementsByTagName("btn");

Thanks guys


- joel

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by jcarbillon
0

Method GetElementsByTagName return an object of NodeList.

XmlNodeList nodelist= lblDocument.GetElementsByTagName("btn");
 if (nodelist.Count != 0)
    SaveBtn.Text = nodelist.Item(0).InnerText;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.