当前位置:编程学习 > C#/ASP.NET >>

请教asp.net 报表打印问题?

=====打印代码========

public partial class ReportView : System.Web.UI.Page
{
    private ClassData clsData = new ClassData();
    private ClassCommon clsCommon = new ClassCommon();

    private ReportDocument TmpReport;

    protected void Page_Load(object sender, EventArgs e)
    {
        string strRptName=Request["rpt"].ToString();

        if (File.Exists(Server.MapPath("~\\Reports\\" + strRptName)))
        {
            ViewReport(strRptName );
        }
        else
        {
            Response.Write("<script>alert('报表文件[" + strRptName + "]不存在!');history.back();</script>");

            return;
        }

    }

    private void ViewReport(string rptName)
    { 
        TmpReport =new ReportDocument();
        string rptPath = Server.MapPath("~\\Reports\\" + rptName);

        TmpReport.FileName = rptName;
        TmpReport.Load(rptPath );

        DataSet dt=new DataSet() ;
        string strSql = " Select ID,ItemCode,ItemName,Amount,AddDate ";
        strSql = strSql + " From Tb_CostDetail ";
        dt = clsData.GetDataSet(strSql);

        TmpReport.SetDataSource(dt);
        CryRptView.ReportSource = TmpReport;

    }

}

=======发生网页错误=============
sys.webforms.pagerequestmanagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(),response filters,HttpModules,or server trace is enabled.
Details:error parsing near '

<!DOCTYPE html P'.
代码:0
URL:http://localhost:489212/FMS/CostRecord.aspx

补充:哪位大侠能解决问题 或给个成功执行的打印代码,谢谢! --------------------编程问答-------------------- 自己顶顶
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,