954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

asp.net & xml

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

jcarbillon
Light Poster
43 posts since Aug 2011
Reputation Points: 10
Solved Threads: 2
 

Method GetElementsByTagName return an object of NodeList.

XmlNodeList nodelist= lblDocument.GetElementsByTagName("btn");
 if (nodelist.Count != 0)
    SaveBtn.Text = nodelist.Item(0).InnerText;
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

Super Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

jcarbillon
Light Poster
43 posts since Aug 2011
Reputation Points: 10
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You