问题描述:ASP.NET Wijmo的GridView 控件实现分组
问题解答:ASP.NET Wijmo的GridView 控件可以支持从一个数据源显示项目,并且可以交互式选择、编辑、删除、排序和分组数据。本文介绍如何从一个数据源显示项目,并且根据拖拽到指定位置的列进行分组,组的最初可以是折叠也可以是展开,该表格在各组的头行旁边可以显示展开或折叠图标。分组的行可以显示汇总数据,例如,数量或金额。
关键代码:
- <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\C1NWind.mdb;Persist Security Info=True" providername="System.Data.OleDb" selectcommand="SELECT TOP 50 Products.ProductName, d.OrderID, d.Quantity, (d.UnitPrice * d.Quantity) as Total FROM Products INNER JOIN (SELECT details.ProductID, details.OrderID, details.UnitPrice, details.Quantity FROM [Order Details] AS details INNER JOIN (SELECT OrderID FROM Orders WHERE Year(OrderDate) = 1994) AS tmp ON details.OrderID = tmp.OrderID) as d ON Products.ProductID = d.ProductID ORDER BY d.ProductID">
- </asp:sqldatasource>
复制代码
效果截图:
源码下载:
ASP.NET Wijmo的GridView 控件实现分组示例 |