pdf生成后未触发按钮单击事件

时间:2019-06-27 16:45:49

标签: c# asp.net nreco

我试图使用按钮click(name-gencode)生成具有四个字段的pdf,并使用nreco pdf generator生成pdf,然后尝试使用另一个按钮click(name-save)将条目保存在数据库中。但是一旦我的pdf用按钮click(gencode)生成,然后当我单击我的保存按钮时,按钮单击事件(保存)没有被触发,我的项目正退出登录页面。我的问题是我想要使用保存按钮将字段保存到数据库中,一旦生成pdf,该按钮将不起作用。

在gencode按钮中,有以下代码

        string filename = strCOCid + "_AuditReport.pdf";
        var pdfBytes = (new NReco.PdfGenerator.HtmlToPdfConverter()).GeneratePdf(docContent.ToString());
        string path = Server.MapPath("~/AuditReport/") + filename;
        File.WriteAllBytes(path, pdfBytes);

然后在保存按钮中单击

            DLdb.RS.Open();
            DLdb.SQLST.CommandText = "insert into CPDActivities (Activity,CPDStream,Category,EndDate,StartDate,Points,ProductCode,QRCode,isActive) values (@Activity,@cpdstream,@Category,@EndDate,@StartDate,@Points,@ProductCode,@QRCode,@active)";
            DLdb.SQLST.Parameters.AddWithValue("Activity", Activity.Text.ToString());

.....................

response.redirect(当前页面)

0 个答案:

没有答案