Dynamic IFrame Population

S

Scott Nichols

Hello,

I have an asp.net application. The application dynamically creates an
invoice. It is important to see and approve the invoice before it is
updated in the database.

So...I was dynamically creating a PDF file and writing the PDF file to
disk and then updating an ifram src attribute on the server side to
reference the newly created file.

I want to move away from disk-based dynamic generation to memory based
generation. So far so good. I now have a byte stream in memory
representing the PDF file.

My problem is I now want to dynamically populate the iframe with this
byte stream.

Any suggestions??

-Thanks,

Scott
 
H

Hermit Dave

Create a new .aspx page where you use
Response.CotentType = "your content Type"
Response.BinaryWrite = your_byte_array

now to instantiate it within any other aspx object or say frame all you need
to do is call the above page and you can do all your funky duo code out
there....

never used iframes but dont think its such a big deal different

HTH

HD
----------------------------------------------------------------------------
---
use of the aspx as in my current code

<ItemTemplate>
<P align="center">
<asp:image id="Image1Data" runat="server" ImageUrl='<%#
"CA_DisplayImage.aspx?ProductColorID=" +
DataBinder.Eval(Container.DataItem,"ProductColorID") +
"&IsDefaultImage=true&showThumbnail=true" %>' >
</asp:image>
</P>
</ItemTemplate>

----------------------------------------------------------------------------
---
code snippet for my Display image aspx page's page_load( ).

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
// Check will be made on data being returned earlier to see if image 2
exists before
if(Request["ProductColorID"]!= null && Request["ProductColorID"]!="")
{
bool IsDefaultImage = true;
string ContentType = "";
bool showThumbnail = false;
if(Request["IsDefaultImage"]!=null && Request["IsDefaultImage"]!="" &&
Request["IsDefaultImage"].ToLower()!="true")
IsDefaultImage = false;
int ProductColorID = int.Parse(Request["ProductColorID"]);

if(Request["showThumbnail"] != null && Request["showThumbnail"] != "" &&
Request["showThumbnail"].ToLower() == "true")
showThumbnail = true;

ImagesDB myImage = new ImagesDB();
byte[] ImageData = myImage.GetImage(ProductColorID, IsDefaultImage, ref
ContentType);
if(ImageData != null)
{
if(showThumbnail == true)
GetThumbnailData(ref ImageData);
else
{
Response.ContentType = ContentType;
Response.BinaryWrite(ImageData);
}
ImageData = null;
}
else
{
DrawImageNotFound();
}
}
else
{
DrawImageNotFound();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top