2012-01-05 10 views
2

こんにちは私はlinqを使ってコードビハインドからxmlの情報をgridviewに入力しています。私はxml( "値要素")内の私の要素の1つに従って私のグリッドを注文したいが、これを行う方法を理解することはできません。何か案は?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(?????) 

答えて

3
gvResourceEditor.DataSource = _ 
    From resElem In resourceElements.Elements("data") _ 
    Select Data = 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) _ 
    } Order By Data.Value 
+0

パーフェクト!ありがとうございました :) – Arno

関連する問題