"Jim" <Ji*@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
Thanks Brian, but I am a little confused on how to use the
Response.BinaryWrite from the code behind when the method is called from
the
repeater control. What would the method look like in the code behind?
Step back. There's no need to do it all in one page. In any web page the
HTML gets served in response to the first request for the URL and the
browser then makes further requests to collect any referenced resources,
like stylesheets, scripts, or images.
We're dealing with two separate aspx pages now.
You have one page, lets call it mainpage.aspx that includes a repeater that
includes repeated instances of the image...
<ItemTemplate>
<asp:Image ID="myImage" Runat="Server"
ImageUrl='myBLObHandler.aspx?id=<%#
Container.DataItem("myImageIdentifier") %>' />
</ItemTemplate>
The only code that gets called in this page is the databinding to get the
<img ... /> tag rendered once for each data row in the data source. This
results in:
<img src='myBLObHandler.aspx?id=1' />
<img src='myBLObHandler.aspx?id=2' />
<img src='myBLObHandler.aspx?id=...' />
<img src='myBLObHandler.aspx?id=n' />
This goes out as the normal text output to the response stream. The
receiving browser renders the HTML and picks up references to source files
for four images so makes requests back to your server for each image.
This is where the second file comes in.
You need an aspx page called myBLObHandler.aspx to handle the request.
This page has no HTML, its purely code behind.
The code takes the id given in the parameters, uses it to extract the
required binary content from the db, and then streams that binary content
back using Response.BinaryWrite()
Clear?
Brian Lowe
---------@