0

我有一个绑定到 LinqDataSource 的可用性报告查看器控件:

<MyReport:ReportViewer ID="rvAvailabilty" runat="server" >
    <LocalReport>
        <DataSources>
            <MyReport:ReportDataSource DataSourceId="ldsAvailabiltyRows" Name="DataSetAvailabilty" />
        </DataSources>
    </LocalReport>
</MyReport:ReportViewer>


<asp:LinqDataSource ID="ldsAvailabiltyRows" runat="server" ContextTypeName="MyApp.MyDataContext" EntityTypeName="MyApp.AvailabiltyRow" OnSelecting="ldsAvailabiltyRows_Selecting" >
</asp:LinqDataSource> 

在后面的代码中,我指定了一个存储库调用以返回一组有序(按字母顺序)的行。存储库中的顺序是正确的。

public void ldsAvailabiltyRows_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
    e.Result = repo.GetReportAvailabiltyRows(); // this repository call returns the correctly ordered data set
}

但是,生成报表时,数据集的顺序对报表不起作用。如何在我的报告中强制执行正确的从上到下的顺序?

4

1 回答 1

0

我发现了自己的答案:报告的 RDLC 在其 tablix 的行级别定义了一个组。在每个组中,都会创建一个默认的“排序依据”列,并且此设置会覆盖我的 LinqDataSource 指定的任何顺序。

于 2012-03-23T16:16:39.740 回答