OK – this might well be one of the “biggest” web control I ever used.
The application we’re building has a feature that let’s the user play around with columns and rows to their need. Much like the Pivot-features of Excel. When I first saw this (current application is developed in ASP.OLD mind you) I shivered a bit since it looked pretty messy.
It’s pretty amazing since is almost completely replicates the functionality from Excel with very little code. Also it comes with the possibility to export to PDF, Excel, HTML, CSV etc.
Here is a short example on how you use the pivot grid in a very crude fashion, in code rather than configuring it at design time.
// In .Designer.cs...
protected global::DevExpress.Web.ASPxPivotGrid.ASPxPivotGrid ASPxPivotGrid1;
protected void Page_Init(object sender, EventArgs e)
var ds = HämtaData(SQL1); // Returns some data from the database
ASPxPivotGrid1.DataSource = ds;
foreach (var column in ds.Tables.Columns)
ASPxPivotGrid1.Fields.AddField(new PivotGridField(column.ToString(), PivotArea.FilterArea));
Oh yeah – notice that you’ll need to be in the Page_Init event for this to work… Those crazy WebForms guys and their events – why go complicated when ASP.NET MVC is so easy :)
Published byon Last updated