填充绑定到 LinqDataSource 的报表查看器控件时出现行顺序错误
我有一个绑定到 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
}
但是,生成报告时,数据集的顺序不适用于报告。如何在报告中强制执行从上到下的正确顺序?
I have an Availability Report Viewer control bound to a 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>
In the code behind, I am specifying a repository call to return a ordered (alphabetic) set of rows. The order is correct from the repository.
public void ldsAvailabiltyRows_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
e.Result = repo.GetReportAvailabiltyRows(); // this repository call returns the correctly ordered data set
}
However, when the report is generated, the order of the dataset is not working on the report. How can I enforce correct top to bottom order on my report?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了自己的答案:报告的 RDLC 在其 tablix 的行级别定义了一个组。在每个组中,都会创建一个默认的排序依据列,并且此设置将覆盖我的 LinqDataSource 指定的任何顺序。
I discovered my own answer : The report's RDLC had a group defined at the row level of it's tablix. Within each group there is a default Sort By column created, and this setting was overriding whatever order my LinqDataSource was specifying.