Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

EntityDataSource.OrderByParameters Property

Gets the collection of parameters that are used to create the ORDER BY clause.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Entity (in System.Web.Entity.dll)
[BrowsableAttribute(false)]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
public ParameterCollection OrderByParameters { get; }

Property Value

Type: System.Web.UI.WebControls.ParameterCollection
The parameters that are used for creating the ORDER BY clause.

When the AutoGenerateOrderByClause property of the EntityDataSource control is set to true, the control automatically generates an ORDER BY clause from the parameter in the ParameterCollection assigned to the OrderByParameters property. This eliminates the need to explicitly assign an ORDER BY clause to the OrderBy property. The construction of the ORDER BY clause from the OrderByParameters property requires that the Name property of the parameter in the collection identifies a single property of the item that is returned from the query.

The following example automatically generates the ORDER BY clause and uses the value of the orderByDropDownList to set the value of the parameter.

<asp:EntityDataSource ID="SalesOrderHeader" runat="server" 
    ConnectionString="name=AdventureWorksEntities"
    DefaultContainerName="AdventureWorksEntities" EnableDelete="True" 
    EnableInsert="True" EnableUpdate="True" EntitySetName="SalesOrderHeader" 
    Where="it.OnlineOrderFlag = true" AutoGenerateOrderByClause="True">
    <OrderByParameters>
        <asp:ControlParameter Name="OrderByParameter" 
            ControlID="orderByDropDownList" Type="String" />
    </OrderByParameters>
</asp:EntityDataSource>

.NET Framework

Supported in: 4, 3.5 SP1

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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.