Solved

How do I display a Byte[] array as part of an ASP.NET webpage?  (SQL Reporting Services)

Posted on 2004-07-30
4
1,401 Views
Last Modified: 2008-02-01
Hi there.

I am looking to include the contents of a Byte[] array into an ASP.NET webpage I am using.  I am generating this Byte[] array using SQL Server 2000 Reporting Services, although you do not need to be familiar with this technology to help me out.  My goal is to display this Byte[] array in a fixed place in harmony with the rest of my ASP.NET page controls.

Here is my backend code, written in C#:

      Byte[] report;
      localhost.ReportingService rs = new localhost.ReportingService();
      /* stuff */
      report = rs.Render(all those parameters);
      /* more stuff */
      Response.BinaryWrite(report);

The key line is "Reponse.BinaryWrite(report);".  The Report generation stuff works.  What I'm getting is a webpage loading displaying the Report at the top, followed by the header and the rest of the page.

What I'd like is for this report to display in a certain place...say within a panel control, for example.  How can I do this?

Thank you very much,
Jason
0
Comment
Question by:jasonwisdom
  • 2
4 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 11678447
You can display it within a literal control within a panel...

myLiteralControl.text = Convert.ToBase64String(report)
0
 
LVL 10

Accepted Solution

by:
jnhorst earned 125 total points
ID: 11679191
Jason:

Use an <iframe src="yourpage.aspx"></iframe> tag to show the report within another page.  You can make it a server side control with runat="server".  If you want to change attributes on the codebehind, use the Attributes collection, like this:

iframe1.Attributes["src"] = "yourpage.aspx?param=value";

This way you can pass instructions to Reporting Services in the URL querystring.

John
0
 
LVL 1

Author Comment

by:jasonwisdom
ID: 11679558
Thank you John, the <iframe /> idea worked.  It requires a second page, however as this expands I see needing MDI-like functionality, so this is a bonus.


raterus, using a literal control in a panel did not work.  SQL Reporting Services returns a binary object, and when I executed the line...
Literal1.Text = Convert.ToBase64String(report);
..., I saw in the control a string which looked like this:

PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEgVHJhbnNpdGlvbmFsLy9FTiI+DQo8aHRtbD4NCjxoZWFkPg0KPHRpdGxlPg0KUmVwb3J0MQ0KPC90aXRsZT4NCjxNRVRBIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ij4NCjxNRVRBIGh0dHAtZXF1aXY9IkNvbnRlbnQtU3R5bGUtVHlwZSIgY29udGVudD0idGV4dC9jc3MiPg0KPE1FVEEgaHR0cC1lcXVpdj0iQ29udGVudC1TY3JpcHQtVHlwZSIgY29udGVudD0idGV4dC9qYXZhc2NyaXB0Ij4NCjxNRVRBIEhUVFAtRVFVSVY9IkxvY2F0aW9uIiBDT05URU5UPSJodHRwOi8vbG9jYWxob3N0L1JlcG9ydFNlcnZlcj8lMmZSZXBvcnRQcm9qZWN0MSUyZlJlcG9ydDEiPjxNRVRBIEhUVFAtRVFVSVY9IlVyaSIgQ09OVEVOVD0iaHR0cDovL2xvY2FsaG9zdC9SZXBvcnRTZXJ2ZXI

Thank you for your time, though.  I also began to try using a MemoryStream object, but found the iframe idea before I carried that to completion.

Jason
0
 
LVL 1

Author Comment

by:jasonwisdom
ID: 11679636
Apologies for going haywire with the width.......is there any way I can edit my own message?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question