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,360 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now