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

[Solved] PDF in Window

10 Answers 169 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
JULIA
Top achievements
Rank 1
JULIA asked on 24 Aug 2010, 02:17 PM
Hello,

is there a way to open a Window and assign it's content to be a streamed PDF file?

Regards,
Timo

10 Answers, 1 is accepted

Sort by
0
JULIA
Top achievements
Rank 1
answered on 25 Aug 2010, 01:48 PM
Hello,

or is there a way to render a classic ASP.NET UserControl or the ReportViewer control inside the window?

Regards,
Timo
0
Hristo Germanov
Telerik team
answered on 26 Aug 2010, 11:00 AM
Hi Timo,

I have implemented your scenario by using an iframe element inside a window. On the other hand you can nest ASP.NET web form controls in a window.

Attached is a sample project how to do that.

Sincerely yours,
Hristo Germanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
JULIA
Top achievements
Rank 1
answered on 30 Aug 2010, 06:26 AM
Hello,

thanks. Maybe do you have a sample for the ReportViewControl? I need a solution to show a pdf which is a byte[] or a rdlc file.

Regards,
Timo
0
Atanas Korchev
Telerik team
answered on 30 Aug 2010, 07:23 AM
Hi Timo,

What do you mean by ReportViewer control? Could you please elaborate? There is a code library showing how to use the Telerik report viewer in an ASP.NET MVC application. You can find it here.

Kind regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
JULIA
Top achievements
Rank 1
answered on 30 Aug 2010, 08:17 AM
Hello,

i mean the Microsoft ReportViewerControl to show a .rdlc file or stream a pdf in as byte array.

Regards,
Timo
0
Atanas Korchev
Telerik team
answered on 30 Aug 2010, 08:38 AM
Hello Timo,

We have not tested the Microsoft ReportViewer control in ASP.NET MVC. It seems it is not supported by checking this stack overflow question. If you manage to get the ReportViewer control working in an ASP.NET MVC application it should be easy to put it in a window.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
JULIA
Top achievements
Rank 1
answered on 30 Aug 2010, 02:09 PM
Hello,

at the moment i use a classic webform (Contract.aspx).
protected void Page_Load( object sender, EventArgs e )
{
    var reportingHelper = new ReportingHelper();
    var file = reportingHelper.RenderLocalReport( parameters, "~/Files/MyFile.rdlc" );
    Response.ContentType = MimeType.PDF;
    Response.AddHeader( "content-disposistion", "inline; filename=MyFile.pdf" );
    Response.BinaryWrite( file );
    Response.End();
}

The window code:
.Content(() => 
{%>  
    <iframe src='<%= string.Format("{0}WebForms/Contract.aspx", Url.Content("~/")) %>' width="100%" height="100%" >
        <p>IFrame is not supported.</p>
    </iframe>
<%})

This works. but i need this dynamic. how can i refresh the iframe if i click on a button inside a gridrow. or is there a way to reload the window?

$('#contractButton').bind('click', function openWindow(e) {
    // refresh window content and get dataKey
    $('#contractWindow').data('tWindow').open();
}).toggle(!$('#contractWindow').is(':visible'));

Regards,
Timo
0
Atanas Korchev
Telerik team
answered on 31 Aug 2010, 08:08 AM
Hi Timo,

You can try the refresh client side method.

Greetings,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
JULIA
Top achievements
Rank 1
answered on 31 Aug 2010, 08:27 AM
Hello,

the refresh method doesn't solve the problem. the Page_Load handler is executed one time ( initial page load ).

$('#contractButton').bind('click', function openWindow(e) {
    $('#contractWindow').data('tWindow').open();
    $('#contractWindow').data('tWindow').refresh();
}).toggle(!$('#contractWindow').is(':visible'));

Regards,
Timo
0
Atanas Korchev
Telerik team
answered on 31 Aug 2010, 08:31 AM
Hello Timo,

Perhaps the browser is caching the iframe. You can try updating the "src" attribute of the iframe so it is updated:


var src = '<%= string.Format("{0}WebForms/Contract.aspx", Url.Content("~/")) %>';
src += '?rand=' + new Date();

var iframe = $('#contractWindow').find('iframe');
iframe.attr('src', src);


All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
JULIA
Top achievements
Rank 1
Answers by
JULIA
Top achievements
Rank 1
Hristo Germanov
Telerik team
Atanas Korchev
Telerik team
Share this question
or