?
Solved

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

Posted on 2004-07-30
4
Medium Priority
?
1,527 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

764 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