I'm trying to concatenate two nodes with a pspace between them. They are First_Name & Last_Name. I tried the code below but it broke the bidning completely.
This seems to target the Wrong XPath. If you want to pick First Name and Last Name both with a space, you should pick them seperately. I mean you should provide Xpath as a whole for each and then merger them later.
Hope it helps...
Please "Mark As Answer;", if this Post helps you.
Visit My Blog
newbie2C#
Member
694 Points
1179 Posts
how to concatenate two node?
Apr 09, 2012 02:20 PM|LINK
I'm trying to concatenate two nodes with a pspace between them. They are First_Name & Last_Name. I tried the code below but it broke the bidning completely.
Text='<%# XPath("/people/person/@First_Name" + " " + "/people/person/@Last_Name" )kavita_khand...
Star
9767 Points
1930 Posts
Re: how to concatenate two node?
Apr 10, 2012 12:16 PM|LINK
Lets say you have an XML at XML/Customers.xml path.
Customer.xml
<Customers>
<Customer>
<FirstName>Kavita</FirstName>
<SurName>Khandhadia</SurName>
</Customer>
</Customers>
On the server side if you write this.
XDocument xCustomers = XDocument.Load(Server.MapPath("XML//Customers.xml"));
IEnumerable<XElement> customer= (from en in xCustomers.Descendants("Customer")
select en
);
foreach (XElement xE in customer)
{
txtXML.Text = xE.Element("FirstName").Value + " " + xE.Element("SurName").Value;
}
It should work.
This is not very good approch, but as your query is ver raw, this is what I can provide you with.
I would love to change the world, but they wont give me the source code.
kuber.manral
Contributor
3051 Points
714 Posts
Re: how to concatenate two node?
Apr 10, 2012 12:39 PM|LINK
Hi newbie2C#,
This seems to target the Wrong XPath. If you want to pick First Name and Last Name both with a space, you should pick them seperately. I mean you should provide Xpath as a whole for each and then merger them later.
Hope it helps...
Visit My Blog