1.先建立好rdlc資料來源
2.建立一個.aspx頁面
3.在頁面放入ScriptManager控制項
4.放入ReportViewer控制項
說明:
Session["SearchList"] 型態為Datatable 請自行處理
report.aspx
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server"
Font-Names="Verdana"
Font-Size="8pt"
InteractiveDeviceInfos="(集合)"
WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt"
Height="500px"
Width="1000px" >
</rsweb:ReportViewer>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.ReportPath = "D:\\Project\\OrderMReport.rdlc";
ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", Session["SearchList"]));
}
}
沒有留言:
張貼留言