By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,112 Members | 1,584 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,112 IT Pros & Developers. It's quick & easy.

Response.write position

P: n/a
Gav
Hi all,

I have created a user control and I am using Response.Write in the control
to 'write' exactly what I want although it always goes to the top of the
page (above <HTML><HEAD> etc). Can I get it so that it writes it where the
control is on the page?

ie

<html>
blah blah
<body>
<H1> my control </h1>
<webusercontrol:mycontrol />
<html>

at the minute if I do repsonse.write("test") in the user control it writes
like this to the client:

test
<html>
blah blah
<body>
blah blah
<H1> my control </h1>
<html>

where as I would want it to put it where the control is:

<html>
blah blah
<body>
<H1> my control </h1>
test
<html>

Thanks
Gav
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Mon, 1 Sep 2003 21:09:10 +0100, "Gav" <sp**@spam.com> wrote:
Hi all,

I have created a user control and I am using Response.Write in the control
to 'write' exactly what I want although it always goes to the top of the
page (above <HTML><HEAD> etc). Can I get it so that it writes it where the
control is on the page?

ie

<html>
blah blah
<body>
<H1> my control </h1>
<webusercontrol:mycontrol />
<html>

at the minute if I do repsonse.write("test") in the user control it writes
like this to the client:

test
<html>
blah blah
<body>
blah blah
<H1> my control </h1>
<html>

where as I would want it to put it where the control is:

<html>
blah blah
<body>
<H1> my control </h1>
test
<html>


I'm afraid the results of response.write are returned to the client
_before_ the result of your aspx-page (the HTML generated for your
aspx-page)...

However, I would like to see my statement confirmed...

--
NULL
Nov 15 '05 #2

P: n/a
Write your stuff out from your Render method rather than wherever you are
writing it now (probably Page_Load).
--
Justin Rogers
DigiTec Web Consultants, LLC.

"Gav" <sp**@spam.com> wrote in message
news:uO**************@tk2msftngp13.phx.gbl...
Hi all,

I have created a user control and I am using Response.Write in the control
to 'write' exactly what I want although it always goes to the top of the
page (above <HTML><HEAD> etc). Can I get it so that it writes it where the
control is on the page?

ie

<html>
blah blah
<body>
<H1> my control </h1>
<webusercontrol:mycontrol />
<html>

at the minute if I do repsonse.write("test") in the user control it writes
like this to the client:

test
<html>
blah blah
<body>
blah blah
<H1> my control </h1>
<html>

where as I would want it to put it where the control is:

<html>
blah blah
<body>
<H1> my control </h1>
test
<html>

Thanks
Gav

Nov 15 '05 #3

P: n/a

Hi Gav,

There are 2 ways of writing code to client side.
One is overriding Render method, the other is using
RegisterClientScriptBlock method.

I think you can override the render method of the user control and
write your string to HtmlTextWrite.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Gav" <sp**@spam.com>
| Subject: Response.write position
| Date: Mon, 1 Sep 2003 21:09:10 +0100
| Lines: 40
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uO**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: pc2-grim3-3-cust103.nott.cable.ntl.com 81.99.145.103
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:181370
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi all,
|
| I have created a user control and I am using Response.Write in the control
| to 'write' exactly what I want although it always goes to the top of the
| page (above <HTML><HEAD> etc). Can I get it so that it writes it where the
| control is on the page?
|
| ie
|
| <html>
| blah blah
| <body>
| <H1> my control </h1>
| <webusercontrol:mycontrol />
| <html>
|
| at the minute if I do repsonse.write("test") in the user control it writes
| like this to the client:
|
| test
| <html>
| blah blah
| <body>
| blah blah
| <H1> my control </h1>
| <html>
|
| where as I would want it to put it where the control is:
|
| <html>
| blah blah
| <body>
| <H1> my control </h1>
| test
| <html>
|
| Thanks
| Gav
|
|
|

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.