- HTML页面排序字段设置:
<SortExpressions>
<SortExpression>
<Value>=Fields!updateTime.Value</Value>
</SortExpression>
</SortExpressions>
- RDLC表格自带排序:
- 数据输入前排序:
DataTable dt = (DataTable)Session["DD"];
this.ReportViewer1.LocalReport.DataSources.Clear();
DataTable dtCopy = dt.Copy();
DataView dv = dt.DefaultView;
dv.Sort = "updateTime desc";
dt = dv.ToTable();
ReportDataSource reportDataSource = new ReportDataSource("N_order", dt);
this.ReportViewer1.LocalReport.DataSources.Add(reportDataSource);
this.ReportViewer1.LocalReport.Refresh();
- 注意:
RDLC再删除排序字段后,若仍然有排序,需要打开HTML页面删除<sortexpression>...该段代码。
两者排序优先级较高的是RDLC自带的排序方式。