This documentation is archived and is not being maintained.

LinqDataSource.GroupByParameters Property

Gets the collection of parameters that are used to create the Group By clause.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public ParameterCollection GroupByParameters { get; }

Property Value

Type: System.Web.UI.WebControls.ParameterCollection
The parameters that are used to create the Group By clause.

The LinqDataSource control uses parameters in the GroupByParameters collection to create the Group By clause at run time. Typically you will not use the GroupByParameters collection to group data. Instead, you can use the GroupBy property. You use the GroupByParameters collection only when a value in the Group By clause must be set at run time and that value is not a property name. For example, use the GroupByParameters collection to group data based on whether the LastName property in the data records equals a value provided by the user.

If you want to group data by a property and that property does not have to be set at run time, you can define the grouping property in the GroupBy property. For example, to return values from a database table grouped by LastName, set GroupBy to "LastName" without any parameters. If you want to dynamically group data by a property, create an event handler for the Selecting event and customize the GroupBy property as needed.

You cannot assign the name of a property as the value for a parameter in the GroupByParameters collection. You add parameters to the GroupByParameters collection when you want to add a condition to the GroupBy property that must be set at run time.

To set values in the GroupByParameters collection, you assign a name to each parameter and then add a placeholder in the GroupBy property for that named parameter. In the Group By clause, preface each parameter name with the @ symbol.

.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.