EntityDataSource.OrderBy Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the Entity SQL expression that specifies how to order the query results.
public:
property System::String ^ OrderBy { System::String ^ get(); void set(System::String ^ value); };
public string OrderBy { get; set; }
member this.OrderBy : string with get, set
Public Property OrderBy As String
Property Value
The ORDER BY clause.
Examples
The XML markup in the following example, in an .aspx file, retrieves a value from a control and passes it as a parameter to the Where property.
<asp:EntityDataSource ID="SalesOrderHeader" runat="server"
ConnectionString="name=AdventureWorksEntities"
DefaultContainerName="AdventureWorksEntities" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" EntitySetName="SalesOrderHeader"
EntityTypeFilter="" OrderBy="it.TotalDue DESC" Select=""
Where="it.OnlineOrderFlag = TRUE AND it.TotalDue > @ordercost">
<WhereParameters>
<asp:ControlParameter ControlID="costLimit" DbType="Int32"
DefaultValue="2500" Name="ordercost" PropertyName="Text" />
</WhereParameters>
</asp:EntityDataSource>
The previous XML example is equivalent to the following ObjectQuery<T> named onlineOrders
:
ObjectQuery<SalesOrderHeader> onlineOrders =
context.SalesOrderHeader
.Where("it.OnlineOrderFlag = TRUE AND it.TotalDue > @ordercost",
new ObjectParameter("ordercost", orderCost))
.OrderBy("it.TotalDue DESC");
Remarks
The OrderBy property of the EntityDataSource control is a string that represents an ORDER BY expression of an Entity SQL query. This string is passed, without modification, to an ObjectQuery<T> that is executed by the Entity Framework. This query is the source of the data regulated by the EntityDataSource control. The string supplied to the OrderBy property uses the same format as the string that is passed to the OrderBy method of ObjectQuery<T>. For examples of how to use the ORDER BY clause to order query results, see How to: Sort Data.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기