0
我有一个网格,使用iTextSharp DLL生成PDF文件的页面。该代码如下:生成PDF并创建下载后的绑定网格
var document = new Document();
bool download = true;
if (download == true)
{
PdfWriter.GetInstance(document, Response.OutputStream);
BindGrid();
}
string fileName = "PDF" + DateTime.Now.Ticks + ".pdf";
try
{
document.Open();
// adding contents to the pdf file....
}
catch (Exception ex)
{
lblMessage.Text = ex.ToString();
}
finally
{
document.Close();
BindGrid();
}
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
Response.Flush();
Response.End();
BindGrid();
}
我需要一次下载窗口弹出,或者用户点击下载之后,在没有问题,我只是需要电网的用户生成后绑定到网格绑定pdf文件。我曾尝试结合上许多地方,你可以看到网格,但它们都没有工作,网格结合后,才刷新页面:(。
有什么办法,我可以做到这一点???
有些代码会有帮助:P – perkes456 2014-12-02 11:59:13
检查编辑的答案。我没有测试它,但它应该工作。 – dario 2014-12-02 12:46:48