The process of exporting reports in visual webgui is really different from that in webform. However, the solution is found in the visual webgui forum. Httpresponse is the same, but visual webgui requires its own method. Otherwise, the final export is only a lot of garbled code displayed on the page.
This is the link to the solution described in the Forum: Visual webgui Forum
The following section excerpt (the last post of the above link ,. In this example, we will take a look at the report control rdlc that comes with Visual Studio.
The form which tries to open the PDF file must be a gizmox Gateway Control ("igatewaycontrol") so it will handle the file writing response disconected from webgui's main response. in order to solve your problem, implement the gizmox. webgui. common. interfaces. igatewaycontrol interface as follow:
Public Class Form1: form, igatewaycontrol {Public Form1 () {initializecomponent ();} Private Void Button#click ( Object Sender, eventargs e) {link. Open ( New Gatewayreference ( This , "Open" ));} # Region Igatewaycontrol members Public Igatewayhandler getgatewayhandler (icontext objcontext, String Straction) {localreport local = New Localreport (); Local. reportpath = context. server. mappath ( "~ /Report1.rdlc" ); Dataset1 dataset = New Dataset1 (); dataset1tableadapters. tabla1tableadapter adapter = New Webguiapplication1.dataset1tableadapters. tabla1tableadapter (); Adapter. Fill (Dataset. tabla1); reportdatasource datasource = New Reportdatasource ( "Datasetasktabla1" , Dataset. tabla1); Local. CES. Add (datasource ); String Reporttype = "Pdf" ; String Mimetype ="Application/pdf" ; String Encoding; String Filenameextension; // The deviceinfo settings shocould be changed based on the reporttype // Http://msdn2.microsoft.com/en-us/library/ms155397.aspx String Deviceinfo = "<Deviceinfo>" + "<Outputformat> pdf </outputformat>" + "<Pagewidth> 8.5in </pagewidth>" + "<Pageheight> 11in </pageheight>" +"<Margintop> 0.5in </margintop>" + "<Marginleft> 1In </marginleft>" + "<Marginright> 1In </marginright>" + "<Marginbottom> 0.5in </marginbottom>" + "</Deviceinfo>" ; Warning [] warnings; String [] Streams; Byte [] Renderedbytes; // Render the report Renderedbytes = Local. Render (reporttype, deviceinfo, Out Mimetype, Out Encoding, Out Filenameextension, Out Streams, Out Warnings ); // Clear the response stream and write the bytes to the outputstream // Set content-disposition to "attachment" so that user is prompted to take an action // On the file (open or save) Httpresponse objresponse = This . Context. httpcontext. response; objresponse. Clear (); objresponse. clearheaders (); objresponse. contenttype = mimetype; objresponse. addheader ( "Content-disposition" , "Attachment; filename = Foo ." + Filenameextension); objresponse. binarywrite (renderedbytes); objresponse. Flush (); objresponse. End (); Return Null ;} # Endregion }