2
你好,我正在使用LINQ来填充gridview与从代码隐藏xml的信息。我想根据xml中的一个元素(“value元素”)来订购我的Grid,但无法弄清楚如何做到这一点。有任何想法吗?LINQ:订购者匿名类型
gvResourceEditor.DataSource = (From resElem In resourceElements.Elements("data") _
Select New With { _
.Key = resElem.Attribute("name").Value, _
.Value = HttpUtility.HtmlEncode(resElem.Element("value").Value), _
.Comment = If(resElem.Element("comment") IsNot Nothing, HttpUtility.HtmlEncode(resElem.Element("comment").Value), String.Empty) _
}).OrderBy(?????)
完美!谢谢 :) – Arno 2012-01-05 12:51:57