0
I組我的數據如下ASP.NET/C# LINQ的通過長度綁定到的GridView
int[] a = { 1, 2, 3,45,45,100,566};
var result =
a.GroupBy(x => x.ToString().Length).
Select(d => new { Key = d.Key, Grp = d });
我的BulletedList嵌套在GridView中(如放置模板字段)顯示的項目,這是結合的方式GridView顯示「Key」時BulletedList。
GridView1.DataSource = result;
GridView1.DataBind();
+1爲正確的答案,但作爲有關的問題:添加GridView1.DataKeyNames =「Key」;就在DataBind()之前 –