473,769 Members | 7,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

response.write question

EMW
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.

How can I do this?

rg,
Eric
Nov 19 '05 #1
22 1601
Well, you've got 2 choices:

1. Use ASP (looks like what you're used to)
2. Learn ASP.Net's Object-oriented programming model.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"EMW" <so*****@MikroZ oft.com> wrote in message
news:42******** **************@ dreader2.news.t iscali.nl...
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.

How can I do this?

rg,
Eric

Nov 19 '05 #2
Response.Write is almost never used any more, mainly because of the reason
you pointed out.

Instead you should probably use a Label control, a PlaceHolder control, or
some other control, since they can be placed precisely at design time.
Then you can set it from your code behind like this:

Label1.Text="Wh atever"

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"EMW" <so*****@MikroZ oft.com> wrote in message
news:42******** **************@ dreader2.news.t iscali.nl...
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.

How can I do this?

rg,
Eric

Nov 19 '05 #3
Response.Write is ver much against the entire zen of ASP.NET's object model.
Sure, use it for debugging (though Trace.Write is much better), but you shouldn't
be using it for rendering your page. If you want something to be added to
your page, put a <asp:Label runat=server id=_myInfo /> (or some other server
side control) and set the _myInfo.Text proeprty to the string you want visible.
This is a higher level object model that's very different than classic ASP.
It's definetly different, but a much more productive model once you get used
to it.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.

How can I do this?

rg,
Eric


Nov 19 '05 #4
This might make more sense and this is what I do.

Create a new aspx page and at the top put a PlaceHolder control. Call
it something like PH1. Next, you need to append your page content to
the pageholder. So lets say the first thing on the page is a heading:

Dim T1 as New LiteralControl
T1.Text = "<FONT Face = ""Arial"">T his is my heading</FONT>"
T1.ID = "T1" ' Optional
PH1.Controls.Ad d(T1)

Dim B1 as new Button
B1.Text = "Submit"
B1.ID = SomeVal
PH1.Controls.Ad d(B1)

When this page is loaded you'll get a heading and a button below it.
For more complex pages with tables an so on I typically define strings
like:

TableStart as String = "<TABLE><TR><TD >"
MyContent as String = "<DIV Align=Center>My Content!</DIV>"
TableEnd as String = "</TD></TR></TABLE>"

I then define 3 LiteralControl' s, assign the text to them and add them
in order to the placeholder. I found this method much more flexible
for inserting error texts into the page (actually into the placeholder
order). I use response.write only for temporary debugging messsages.
You can also visually design a skeleton of your page and put
placeholders where you want dynamic content to appear. I recently did
an entire aspx page of nothing but dynamically created controls and
content. It works very well.

Pardon any errors above but it's a better answer than 'rtfm'. ;)

On Tue, 29 Mar 2005 22:19:59 +0200, "EMW" <so*****@MikroZ oft.com>
wrote:
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.

How can I do this?

rg,
Eric


Nov 19 '05 #5
Hello Kevin,

And this response helped how?

In the time that it takes to come off with an answer like this, why not construct
an answer that may remotely help the original poster?

--
Matt Berther
http://www.mattberther.com
Well, you've got 2 choices:

1. Use ASP (looks like what you're used to)
2. Learn ASP.Net's Object-oriented programming model.
Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.
"EMW" <so*****@MikroZ oft.com> wrote in message
news:42******** **************@ dreader2.news.t iscali.nl...
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.
How can I do this?

rg,
Eric


Nov 19 '05 #6
> And this response helped how?

I have no idea. A response can help, but it is up to the receiver to make it
help. A doctor can prescribe medicine, but if the patient doesn't take it,
the patient doesn't get well.
In the time that it takes to come off with an answer like this, why not
construct an answer that may remotely help the original poster?
Well, now, if I were a doctor, and someone came into my office with a cough,
I suppose I could give them some cough syrup and send them on their merry
way. Somehow I get the feeling that this is what you would do. A GOOD doctor
would examine the patient, determine the disease that is causing the
symptoms, and prescribe some medicine that would kill the disease, not
simply make the patient stop coughing.

In this case, my self-appointed Mentor, I diagnosed that the poster had
virtually no experience with Object-oriented programming, and was trying to
work with technology that he was almost completely unfamiliar with. How did
I diagnose this? Well, I read between the lines. Wish I could explain the
technique to you, but it requires some abstract thought to comprehend.

I could have given him some cough syrup and sent him on his merry way. My
conscience wouldn't allow me to do that. So, I risked your wrath, and the
wrath of all the other self-appointed judges out there, and told him what he
needed to hear, not necessarily what he wanted to hear. Sue me.

BTW, how much did your post help him? Or did you just want to be recognized
as a beacon of compassion in a coldly logical world?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"Matt Berther" <mb******@hotma il.com> wrote in message
news:22******** *************** ****@news.micro soft.com... Hello Kevin,

And this response helped how?

In the time that it takes to come off with an answer like this, why not
construct an answer that may remotely help the original poster?

--
Matt Berther
http://www.mattberther.com
Well, you've got 2 choices:

1. Use ASP (looks like what you're used to)
2. Learn ASP.Net's Object-oriented programming model.
Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.
"EMW" <so*****@MikroZ oft.com> wrote in message
news:42******** **************@ dreader2.news.t iscali.nl...
Hi,

When I use
Response.Write "something"
it is placed at the top op de html document above the <HTML> tag.
I need it to be put in the BODY part.
How can I do this?

rg,
Eric


Nov 19 '05 #7
On Tue, 29 Mar 2005 16:48:07 -0500, "Kevin Spencer"
<ke***@DIESPAMM ERSDIEtakempis. com> wrote:

I could have given him some cough syrup and sent him on his merry way. My
conscience wouldn't allow me to do that. So, I risked your wrath, and the
wrath of all the other self-appointed judges out there, and told him what he
needed to hear, not necessarily what he wanted to hear. Sue me.


So the better solution is 'rtfm'? I'm sure he's out there buried in
textbooks for weeks trying to figure out what I gave him in 3
paragraphs. I asked the same question once. I got a reply like yours
which was 100% useless and a small code example like the one I
provided. I had my pages working in hours.

Anyone can say read the manual. Knowledgable people answer his
question.

Nov 19 '05 #8

Tom wilson wrote:
This might make more sense and this is what I do.

Create a new aspx page and at the top put a PlaceHolder control. Call it something like PH1. Next, you need to append your page content to
the pageholder. So lets say the first thing on the page is a heading:
Dim T1 as New LiteralControl
T1.Text = "<FONT Face = ""Arial"">T his is my heading</FONT>"
T1.ID = "T1" ' Optional
PH1.Controls.Ad d(T1)

Dim B1 as new Button
B1.Text = "Submit"
B1.ID = SomeVal
PH1.Controls.Ad d(B1)

When this page is loaded you'll get a heading and a button below it.
For more complex pages with tables an so on I typically define strings like:

TableStart as String = "<TABLE><TR><TD >"
MyContent as String = "<DIV Align=Center>My Content!</DIV>"
TableEnd as String = "</TD></TR></TABLE>"

I then define 3 LiteralControl' s, assign the text to them and add them in order to the placeholder. I found this method much more flexible
for inserting error texts into the page (actually into the placeholder order). I use response.write only for temporary debugging messsages.
You can also visually design a skeleton of your page and put
placeholders where you want dynamic content to appear. I recently did an entire aspx page of nothing but dynamically created controls and
content. It works very well.


Tom, this answer helped me a lot. Just like the original poster, I did
not know how to write dynamic content to the page. Thanks!

-Steve

Nov 19 '05 #9
Did I tell him to "read the manual?"

Glad you got your stuff "working." So, why are you still here? Perhaps you
didn't advance your knowledge, and still need someone to do your fishing for
you?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Tom wilson" <ye*******@nosp am.com> wrote in message
news:05******** *************** *********@4ax.c om...
On Tue, 29 Mar 2005 16:48:07 -0500, "Kevin Spencer"
<ke***@DIESPAMM ERSDIEtakempis. com> wrote:

I could have given him some cough syrup and sent him on his merry way. My
conscience wouldn't allow me to do that. So, I risked your wrath, and the
wrath of all the other self-appointed judges out there, and told him what
he
needed to hear, not necessarily what he wanted to hear. Sue me.


So the better solution is 'rtfm'? I'm sure he's out there buried in
textbooks for weeks trying to figure out what I gave him in 3
paragraphs. I asked the same question once. I got a reply like yours
which was 100% useless and a small code example like the one I
provided. I had my pages working in hours.

Anyone can say read the manual. Knowledgable people answer his
question.

Nov 19 '05 #10

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

Similar topics

6
1465
by: Colin Colin | last post by:
I have an ASP program that is getting an error. When I get the error I get Page Cannot Be Displayed along with the line that causes the error and what the error is. What I am not getting is any data that I write via response.write before the error occurs. The error is happening in a loop, on the third line below: RESPONSE.WRITE("x=" & x & ", " & aFieldsData(UpdateRecNum,x) & "<BR>") tFLD = trim(aFieldsData(UpdateRecNum,x)) tFLD =...
13
4752
by: TinyTim | last post by:
I'm a newbie at ASP & HTML. It seems that when you use server side code and you're going to return a customized HTML form with several fields and labels, you have to do an extensive amount of Response.Writes. Are there any tools that will let you design the form then convert that form to Response.Writes that you can further customize with ASP logic? For instance: use Dreamweaver to design the form, then another program to convert to...
35
34504
by: Eitan | last post by:
Hello, How can I write a line (with carriage return + line feed) to the client ? response.write("abcd"), continue the last line, and doesn't put cr+lf. response.writeLn is illegal syntax... Thank :)
6
3058
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a cookie (say Response.Cookies ("TEST")) and you have a query string variable &test=x or &Test=x and you get Request.QueryString to parse the query string, the cookie that gets dropped matches the case of the query string, not what your code says. ...
6
1943
by: dotnettester | last post by:
Woud this work? ..... Response.end set objConn = nothing set objAnyObject = nothing ?
7
43277
by: Anne | last post by:
hie there, i want to be able to pass multiple parameters to another page. currently, i am able to do so, but somehow i feel it is not the correct way to do it. below is part of what i have so far. 'first page Private Sub btnOK_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click Response.Redirect("InputValues.aspx?Requestor=" &
5
2506
by: Luiz Vianna | last post by:
Guys, I need to send some info to my client while I'm processing some stuff. The flow will be something like : -process -response -process -response .... I imagine to use response.flush (as I did on ASP) but it does not work. See my test code, after sending 2 lines on response, I'm simulating a processing time before sending other 2 lines.
11
26886
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as follows: private void SubmitButton_Click (object sender, System.EventArgs e) { // Set up the response to write the print file to the client Response.Clear (); Response.AppendHeader ("Content-Disposition", "filename=WebPrint.prn");
7
4146
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge is how to corelate the response to a corresponding request. I am looking for a sure proof threadsafe way to corelate a response to a coresponding request message. Two things that concerns me:-
6
1501
by: Terry Olsen | last post by:
Is there any way to make response.write NOT be the first thing on the page? I have a page with the title and a sub title (not labels or anything, just typed into the designer). I want the response.write text to appear below the titles and formatted (bold, sized, centered, etc). Thanks. *** Sent via Developersdex http://www.developersdex.com ***
0
10048
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
9996
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
9865
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
8872
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
7410
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
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
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.