下载pdf没有发生

时间:2011-12-28 05:26:57

标签: asp.net telerik-reporting

下载pdf没有发生。我有telerik报告。我正在渲染为pdf并下载它。使用此代码下载没有发生。当我添加""它的工作正常。但这次进展没有显示......

.aspx文件(查看)

  <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upnlStockList"
            DisplayAfter="0" DynamicLayout="true">
            <ProgressTemplate>
                <div class="PopupPanel">
                    <table style="vertical-align: middle; width: 100%; height: 900px">
                        <tr>
                            <td valign="middle" align="center">
                                <img id="Img1" src="~/Images/loading.gif" runat="server" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    <asp:UpdatePanel ID="upnlStockList" runat="server" ChildrenAsTriggers="true" UpdateMode="Always">
            <ContentTemplate>
                <grid></grid>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="imgPDF" />
                <asp:AsyncPostBackTrigger ControlID="imgExcel" />
                <asp:AsyncPostBackTrigger ControlID="imgCSV" />
            </Triggers>
        </asp:UpdatePanel>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

我的代码:

protected void imgExcel_Click(object sender, ImageClickEventArgs e)
{
    (initializing the report and assigning parameter).
    ReportProcessor reportProcessor = new ReportProcessor();
    RenderingResult result = reportProcessor.RenderReport(PDF, rptStockList, null);
    string fileName = result.DocumentName + ".pdf";
    Response.Clear();
    Response.ContentType = result.MimeType;
    Response.Cache.SetCacheability(HttpCacheability.Private);
    Response.Expires = -1;
    Response.Buffer = true;
    Response.AddHeader("Content-Disposition", string.Format("{0};FileName=\"{1}\"", "attachment", fileName));
    Response.BinaryWrite(result.DocumentBytes);
    Response.End();
}

0 个答案:

没有答案