Translated by maninwest@Codeforge Author:Anurag Gandhi@CodeProject
A Grid/Report control in Asp.Net MVC with pivot option
Using the code
To use the code, you just need to add the reference to the ReportControl assembly. Then, you can directly use the code in your view as follows:
@Model.ReportWithPivot("", "ShopName", "SellingPrice", AggregateFunction.Sum, "ItemType", "ItemName")
Please note that your model should be IEnumerable or derrived from IEnumerable only.
How it works
To understand the working of pivot related stuff, please have a look over my previous article: Pivoting DataTable Simplified. Further to that, ReportWithPivot is an extension method to an IEnumerable object which takes RowField, DataField, Aggregate Function and ColumnFields as parameter an