LinqDataSource.GroupByParameters Property

Definition

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

public:
 property System::Web::UI::WebControls::ParameterCollection ^ GroupByParameters { System::Web::UI::WebControls::ParameterCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.ParameterCollection GroupByParameters { get; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.GroupByParameters : System.Web.UI.WebControls.ParameterCollection
Public ReadOnly Property GroupByParameters As ParameterCollection

Property Value

The parameters that are used to create the Group By clause.

Attributes

Remarks

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.

Applies to