Intersoft WebGrid Documentation
Walkthrough: Enabling Aggregate Computation
See Also Send comments on this topic.

Glossary Item Box

This walkthrough will guide you to enable column footer and assign built-in aggregate function to WebGrid.

During this walkthrough, you will learn how to do the following:

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Visual Studio 2008 Application.
  • Microsoft.NET Framework 3.5.
  • Intersoft WebUI Studio.NET 2008 R2.

 Step-By-Step Instructions

To create new web application and enable aggregate function

  1. Continuing from Walkthrough: Enabling Transactions (Add/Edit/Delete), select WebGrid, right click and click WebGrid.NET Designer.
  2. Go to Advanced tab, expand WebGrid and select RootTable. Then click "See all properties" link in the right panel. See below.



  3. Set ColumnFooters property to Yes.
  4. Click on "Columns"node in the left panel.
  5. Select OrderID column, click See all properties.
  6. Set AggregateFunction to Count and FooterText to "Count".
  7. Select Freight column, click See all properties.
  8. Set AggregateFunction to Sum and FooterText to "Sum".
    At this point, you should see something similar to following screen:



  9. Click OK to apply all settings and close the designer.
  10. The last step is to set the ColumnFooterAggregateMode to ExternalDataSource. You can find this property inside LayoutSettings.



    It's very important to set ColumnFooterAggregateMode to ExternalDataSource option in order to take advantage of "LINQ to SQL" features through the connected ISLinqDataSource control.
  11. Save your WebForm, and run it to browser.
  12. Your browser should have similar results as in the following:



    Notice that the Count aggregate result is now shown in OrderID column footer. Although the paging is applied to the WebGrid, the aggregate result is not affected. That means, the aggregate result is computed against the data shape that created by the LINQ query, regardless of paging view.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.