473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on Response.Output Stream

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.Outpu tStream) 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.Output Stream?
Many thanks!
Nov 15 '05 #1
6 9805
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.Outpu tStream) 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.Output Stream?


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.co m>
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.filter s as they are pretty
complex to work with.

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_auth or_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_autho r_plug>
----------------------------------------------

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
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.Outpu tStream) 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.Output Stream?


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.co m>
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.co m>
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.Attr ibutes.Add("onC lick",
"Response.Write (\"<img src=ImagePage.a spx\")");
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.Attr ibutes.Add("onC lick",
"Response.Write (\"<img src=ImagePage.a spx\")");
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.co m>
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
2932
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 Data Item for Databinding is a class with 2 props ... URL Description ***MyMainPage.aspx Page_Load Code ...
3
13770
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 = DirectCast(m_report.FormatEngine.ExportToStream(reqContext), MemoryStream) If (fileName Is Nothing) Then
2
3270
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 add the post data to the headers I get an exception that just says "headers". Can anyone please help me here? Thanks.... public string Get(string u, string c) { WebRequest wr = WebRequest.Create(u); wr.Headers.Add(c);
4
1432
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 tried to asdd any Control Around it Nothing appears bitmap.save(Response.OutputStream,ImageFormat.Gif); Response.Write("Hello World"); if I done the Above code He Displays only the Image without The the
0
1346
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 Response.OutputStream??? WebClient client = new WebClient(); client.Credentials = new NetworkCredential("username", "password"); byte pdfBytes = client.DownloadData(strUrl); Response.ContentType = "application/pdf";...
1
1695
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 document using a XSL file): Function Trans()
3
3379
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 = "../GetLendersAsXML.aspx" var request = GXmlHttp.create(); request.open("GET", urlRequest, true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML;
0
1422
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(); HttpContext.Current.Response.ContentType = "binary/octet- stream"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + strOutputFilename); long lngSize = GetFileSize(strFTPURL, strFileName);
3
2893
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, etc... I have bee trying to do the same thing in ASP.NET by manipulating the Response.OutputStream. I keep getting the error: Exception Details: System.ArgumentException: Stream was not readable. On this line: StreamReader sr = new...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.