Redigera

Dela via


EntityDataSource.OrderByParameters Property

Definition

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

public:
 property System::Web::UI::WebControls::ParameterCollection ^ OrderByParameters { 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 OrderByParameters { get; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.OrderByParameters : System.Web.UI.WebControls.ParameterCollection
Public ReadOnly Property OrderByParameters As ParameterCollection

Property Value

The parameters that are used for creating the ORDER BY clause.

Attributes

Examples

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>

Remarks

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.

Applies to