アイテムのリストを作成日に従って降順で並べ替える方法を理解するのに苦労しています (Sitecore ではアイテムを作成日で昇順で並べ替えることができることを知っています)。私はまだ Sitecore を使い始めたばかりなので、どうすればよいかわかりません...何か提案があれば助かります!
Item[] BlogPosts = HomeItem.Axes.SelectItems(@"child::*[@@templatename='BlogComment']");
if (BlogPosts != null)
{
DataSet ds = new DataSet();
DataTable posts = ds.Tables.Add("posts");
posts.Columns.Add("PostName", Type.GetType("System.String"));
posts.Columns.Add("DateCreated", Type.GetType("System.String"));
posts.Columns.Add("PostComment", Type.GetType("System.String"));
foreach(Item PostItem in BlogPosts)
{
DataRow dr = posts.NewRow();
dr["PostName"] = PostItem.Fields["Name"].Value;
dr["DateCreated"] = PostItem.Statistics.Created;
dr["PostComment"] = PostItem.Fields["Comment"].Value;
posts.Rows.Add(dr);
}
commentsListRptr.DataSource = ds;//this is a repeater I'm using to show the data
commentsListRptr.DataMember = "posts";
commentsListRptr.DataBind();
}