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