0

I want to select a node based on an attribute value. I am using C# program to derive on the attribute value which is stored in a variable. The below code returns null. How can I compare the attribute value against a variable?

     string posSecond = "test";
     SelectSingleNode("//viewentries/viewentry[@position=posSecond]");

Thanks!

2
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by Anitha14
0
SelectSingleNode(string.Format("//viewentries/viewentry[@position='{0}']", posSecond));

should work, assuming the position attribute contains a string value.

Edited by pritaeas

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.