This is a migrated thread and some comments may be shown as answers.

Ajax, Response.BinaryWrite, pdf

4 Answers 223 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Thomas Gross
Top achievements
Rank 1
Thomas Gross asked on 11 Feb 2011, 07:51 PM
I am absulutly despaired. I build a very nice page with your controls.
at the end of the project I have to create a pdf file with all the results from the input of this page.
So i place a ImageButton on the page. This button should not be shown at every situation. So i make it visible or not and put it to the RadAjaxManger. With a third party tool from expertPDF (www.html-to-pdf.net) I want to create my pdf after clicking on the image button.
And than I get the same problem described in this posting:
http://www.codeproject.com/Messages/2617925/ASP-Net-AJAX-Response-Write-and-PDF.aspx

I search for this problem for many hours and I am getting so unhappy now, because I want to filalize my project... please help me ...
thomas

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Feb 2011, 11:14 PM
Hello Thomas,

This topic will help you sidestep the problem easily:
Export from ajaxified grid

Best regards,
Daniel
the Telerik team
0
Thomas Gross
Top achievements
Rank 1
answered on 17 Feb 2011, 12:08 AM
Hallo again,

i know this code and i try it in this way.
Concrete i put in the master page with include my immagebutto ibtPdf

 

<telerik:RadPane ID="Fusszeile" runat="server" Height="37" BackColor="#5e696a" Scrolling="None">

 

 

 

<div id="FooterNav" runat="server" class="footer_nav_right">

 

 

<div style="margin-right: 30px; float: right">

 

 

<asp:ImageButton ID="ibtPdf" runat="server" ImageUrl="Images/create_pdf.png" ToolTip="create PDF" OnClick="ibtPdf_Click"

 

 

Visible="true" />

 

 

</div>

 


the following javascript

<

 

telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">

 

 

<script type="text/javascript">

 

 

function onRequestStart(ajaxManager, eventArgs) {

 

 

 

if (eventArgs.EventTarget.indexOf("ibtPDF") != -1) {

 

 

eventArgs.EnableAjax =

false;

 

 

}

 

}

 

 

</script>

 

 

</

 

telerik:RadCodeBlock>

 


and the following code for the AjaxManager

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" EnableAJAX="True" ClientEvents-OnRequestStart="onRequestStart">

 

 

<ClientEvents OnRequestStart="onRequestStart" />

 

 

<telerik:AjaxSetting AjaxControlID="radMainMenu">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="pnlPageInfoBoxHeaderText" />

 

 

<telerik:AjaxUpdatedControl ControlID="RedBarText" />

 

 

<telerik:AjaxUpdatedControl ControlID="CalculatorWizard" />

 

 

<telerik:AjaxUpdatedControl ControlID="MovePreviousButton" />

 

 

<telerik:AjaxUpdatedControl ControlID="MoveNextButton" />

 

<%

--<telerik:AjaxUpdatedControl ControlID="ibtPdf" />--%> <telerik:AjaxUpdatedControl ControlID="ibtPdf" />

 

 

<telerik:AjaxUpdatedControl ControlID="ibtSendEmail" />

 

 

<telerik:AjaxUpdatedControl ControlID="divPageInfoTooltip" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 


but i get on error in the file TransientScriptDocument164.axd at the following code

try

 

{a._webRequest.completed(Sys.EventArgs.Empty)}finally{if(a._xmlHttpRequest!=null)

 


Laufzeitfehler in Microsoft JScript: Sys.WebForms.PageRequestManagerParserErrorException: Die vom Server empfangene Nachricht konnte nicht analysiert werden. Häufige Ursachen für diesen Fehler sind: Änderung der Antwort durch Aufrufe von Response.Write(), Antwortfilter, HttpModules oder aktivierte Serverablaufverfolgung.
Details: Fehler beim Analysieren in der Nähe von "%PDF-1.4
%????
%Cr".

When i put a breakpoint to the javascript it stops at every situation but not when i click my immagebutton.

Please help me, i have no father idears.

thanks
thomas
0
Daniel
Telerik team
answered on 17 Feb 2011, 01:57 PM
Hello Thomas,

You have to add a separate setting for the initiator button - otherwise the event won't be triggered when you click on the export button.
Copy Code
<telerik:AjaxSetting AjaxControlID="ibtPdf">
    <UpdatedControls>
        ....
    </UpdatedControls>
</telerik:AjaxSetting>

Also I noticed that you have attached the OnRequestStart event twice.

Best regards,
Daniel
the Telerik team
0
Thomas Gross
Top achievements
Rank 1
answered on 17 Feb 2011, 02:18 PM
You are great. It solve my problem. You make me happy.
Thank for the your very good support and your nice development tool
Fantastic
thomas
Tags
Ajax
Asked by
Thomas Gross
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Thomas Gross
Top achievements
Rank 1
Share this question
or