473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help on Response.OutputStream

Hi!
I have this webpage that contains some panels and buttons.
I also want to output an Image to that same page, but when
I save the image to the OutputStream using the Image.Save
(Response.OutputStream) method, the panels and buttons get
overwritten and only the image appears. Is there a way to
preserve the buttons and output the image at the same
time? How do I append to the Response.OutputStream?
Many thanks!
Nov 15 '05 #1
6 9781
Joseph <is**************@yahoo.com> wrote:
I have this webpage that contains some panels and buttons.
I also want to output an Image to that same page, but when
I save the image to the OutputStream using the Image.Save
(Response.OutputStream) method, the panels and buttons get
overwritten and only the image appears. Is there a way to
preserve the buttons and output the image at the same
time? How do I append to the Response.OutputStream?


You don't want to write the image on the same response - you want to
write an image tag, so that the browser then requests the image. Always
think about things from the browser's point of view.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
You can amend the output stream by creating a response.filter. You should
really follow Johns suggestion of writing the tag - not the image though -
it might make you think about avoiding response.filters as they are pretty
complex to work with.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Joseph <is**************@yahoo.com> wrote:
I have this webpage that contains some panels and buttons.
I also want to output an Image to that same page, but when
I save the image to the OutputStream using the Image.Save
(Response.OutputStream) method, the panels and buttons get
overwritten and only the image appears. Is there a way to
preserve the buttons and output the image at the same
time? How do I append to the Response.OutputStream?


You don't want to write the image on the same response - you want to
write an image tag, so that the browser then requests the image. Always
think about things from the browser's point of view.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #3
How to I write to html tags?
the only thing i know is to save the image to the outputstream so that
the whole image is outputted to the window. how do i insert tags to the
outputstream?
i would really appreciate your insights.
thanks very much!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4
joseph abanila <is**************@yahoo.com> wrote:
How to I write to html tags?
the only thing i know is to save the image to the outputstream so that
the whole image is outputted to the window. how do i insert tags to the
outputstream?
i would really appreciate your insights.


You don't insert tags into your output stream. You don't write the
image out at all to start with. On the response which includes your
buttons etc, you have an <img> tag as well as all the buttons. The img
tag will tell the browser which image to fetch.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #5
Thanks so much for that!
The window I'm designing dynamically loads linkbuttons that contains
links of page numbers that navigate to images.
Initially the page only shows the page numbers, and when the page
numbers are clicked, the window should load below the page numbers the
selected image page.

I'm planning to add the attribute of the linkbutton as
LinkButton.Attributes.Add("onClick",
"Response.Write(\"<img src=ImagePage.aspx\")");
Will this work?
After the linkbutton is clicked, will that response.write command
preserve the other elements (the linkbuttons, etc)of the html? Won't it
overwrite the html page and show just the image? How do i know just
exactly where in the html page it will output the image?
You've been of great help! Thank you very much.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #6
joseph abanila <is**************@yahoo.com> wrote:
The window I'm designing dynamically loads linkbuttons that contains
links of page numbers that navigate to images.
Initially the page only shows the page numbers, and when the page
numbers are clicked, the window should load below the page numbers the
selected image page.

I'm planning to add the attribute of the linkbutton as
LinkButton.Attributes.Add("onClick",
"Response.Write(\"<img src=ImagePage.aspx\")");
Will this work?
After the linkbutton is clicked, will that response.write command
preserve the other elements (the linkbuttons, etc)of the html? Won't it
overwrite the html page and show just the image? How do i know just
exactly where in the html page it will output the image?
You've been of great help! Thank you very much.


That doesn't sound quite right to me. I suggest you mock it up in HTML
first, and you may want JavaScript to change the image depending on the
click (then it needn't be a server event at all). I suggest asking in
more detail in the ASP.NET group.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Neil Woodvine | last post by:
***Scenario ... I have a DataList with a hyperlink WebControl in the Item Template. I want to display a 64x64 image in the Hyperlink and set the NavigateURL to the full size image. ***Source...
3
by: Zoury | last post by:
Hi folks ! :O) I'm trying to show a PDF in ASP.NET but I can't get to work properly. here's a portion of my code : '** Dim ms As MemoryStream =...
2
by: Keith Selbee | last post by:
I am trying to submit data to a webpage in the form of a post and my code is below. It is a function that takes a url and the post content as strings and then performs the post. But as soon as I...
4
by: Mahmoud Mousa | last post by:
Hi... Some how I'm facing trouble Saving A Bitmap(I Dynamiclly creat in my Page) Co's Every Time to Started to save the Image.. The Only thing that Appears in my Page is the Image Alone And If I...
0
by: Dave | last post by:
Hi, I'm trying to download a pdf from a secure location and writ e the response to the browser as listed below. However, the form that runs this codes appears to postback when I encounter the...
1
by: shapper | last post by:
Hello, For the past hours I have been trying to solve a problem which is driving me crazy. I have to different codes where the problem to solve is the same: CODE 1 (Transforms a XML...
3
by: JJA | last post by:
I am confused about all the various methods of handling XML in ASP.Net 2.0. I want to be able to stream XML to some clientside Javascript code (snippet below): var urlRequest =...
0
by: Chris Ashley | last post by:
I'm writing files directly to Response.OutputStream... setting the headers like so: HttpContext.Current.Response.Buffer = false; HttpContext.Current.Response.Clear();...
3
by: kellygreer1 | last post by:
PHP will alllow you to build up an entire page and before sending that out as the response.... you can grab all the text and do search and replaces, add comments, make more CSS/XHTML compliant,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.