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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

11 Experts available now in Live!

Get 1:1 Help Now