GetAttributeValue from a child with same name



XML looks like the following, I need to reference the second Name element.value:


Appearance*


Off-white Liquid


5045


My C# looks like this and continues to pull the Attribute from the parent element, not the second 'Name' element while the SubValue value is pulled correctly?:



@{
string secondName = del.GetNavigationItems("Literature", NavigationElementType.TaxonomyNavigation, false, true).Where(elt => elt.GetAttributeValue("Type") != "Image").OrderByDescending(elt => elt.GetAttributeValue("Type")).ToList();

string title = "<b>" + product.GetAttributeValue("Name") + "</b>";
if (product.GetAttributeValue("SubValue") != "")
{
title += ", " + product.GetAttributeValue("SubValue");
}
}
@Html.Raw(title)

No comments:

Post a Comment