Forum  General Visual ...  How do I...?  ReportViewer problem
Previous Previous
 
Next Next
New Post 8/21/2007 7:32 AM
  nelmaya
367 posts
3rd Level Poster


Re: ReportViewer problem 

Hi shlomi

i tryed this but it generates an error with  "Response" even if i use "Context.response" because it doen't have  properties like clear or contentType

 

 

 

 

local.ReportPath = Context.Server.MapPath(

 

 

ciudadTableAdapters.

Adapter.Fill(dataSet.GB_CIUDAD);

 

 

 

 

 

 

 

 

 

LocalReport local = new LocalReport();"~/Report2.rdlc");ciudad dataSet = new ciudad();GB_CIUDADTableAdapter Adapter = new SISBARCO.ciudadTableAdapters.GB_CIUDADTableAdapter();ReportDataSource dataSource = new ReportDataSource("ciudad_GB_CIUDAD",dataSet.GB_CIUDAD);local.DataSources.Add(dataSource);string reportType = "PDF";string mimeType;string encoding;string fileNameExtension;//The DeviceInfo settings should 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)

Context.Response.Clear;

Context.Response.ContentType = mimeType;

Context.Response.AddHeader(

Context.Response.BinaryWrite(renderedBytes);

Context.Response.End();

 

Merci bcp

"content-disposition", "attachment; filename=foo." + fileNameExtension);
 
New Post 8/21/2007 10:32 AM
  nelmaya
367 posts
3rd Level Poster


Re: ReportViewer problem 

Hi Shlomi

i tryed next and I get an strange page with pdf structure but pdf documentodoesn't appear??

LocalReport

local.ReportPath = Context.Server.MapPath(

 

ciudadTableAdapters.

Adapter.Fill(dataSet.GB_CIUDAD);

 

local.DataSources.Add(dataSource);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

renderedBytes = local.Render(reportType, deviceInfo,

 

 

 

 

 

 

 

objResponse.Clear();

objResponse.ContentType = mimeType;

objResponse.AddHeader(

objResponse.BinaryWrite(renderedBytes);

objResponse.Flush();

objResponse.End();

local = new LocalReport();"~/Report2.rdlc");ciudad dataSet = new ciudad();GB_CIUDADTableAdapter Adapter = new SISBARCO.ciudadTableAdapters.GB_CIUDADTableAdapter();ReportDataSource dataSource = new ReportDataSource("ciudad_GB_CIUDAD", dataSet.GB_CIUDAD);string reportType = "PDF";string mimeType = "application/pdf";string encoding;string fileNameExtension ;//The DeviceInfo settings should be changed based on the reportType//http://msdn2.microsoft.com/en-us/library/ms155397.aspxstring 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 reportout 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;"content-disposition", "attachment; filename=foo." + fileNameExtension);
 
New Post 8/23/2007 6:10 AM
  nelmaya
367 posts
3rd Level Poster


Re: ReportViewer problem 

Hi shlomi

any ideas about this ??

 

Merci bcp

 
New Post 8/23/2007 11:15 PM
  Guy
2328 posts
1st Level Poster




Re: ReportViewer problem 

Hi,

Can you send the sample + link + issue description to this thread to support at visualwebgui.com?

Thanks,
Guy

 
New Post 8/26/2007 4:35 AM
  shlomi.bin
558 posts
1st Level Poster




Re: ReportViewer problem 

Hi,

I reviewed the code you that u sent us and here is your problem: 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 button1_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("DataSet1_Tabla1", dataSet.Tabla1);
            local.DataSources.Add(dataSource);

            string reportType = "PDF";
            string mimeType = "application/pdf";
            string encoding;
            string fileNameExtension;

            //The DeviceInfo settings should 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
    }

 

Hope it helped,

Shlomi

 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  ReportViewer problem
Most promising startups
Top 3 most promising startups in 2009
   AJAX Framework | Web Development | Cloud applications | RIA Development | Silverlight Applications | Legacy Migration
The most popular open source Ajax applications framework for enterprises | Sitemap | Terms Of Use | Privacy Statement
Copyright © 2005-2009 Visual WebGui®    Design By: Template World
   
Visual Studio Partners