Responise.Write() seems not to work in codebind.

W

Wootaek Choi

Dear Sir,
I create webform page that
all html code is generated in code behind and sended to IE using
Response.Write() like this,

namespace localhost.XML
{
public class Encoding : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("Request Search and Rescue!!");
}
}
}

Aspx file contains nothing but these strings.
<%@ Page language="c#" Codebehind="Encoding.aspx.cs"
AutoEventWireup="false" Inherits="localhost.XML.Encoding"%>

It worked well.. When client checked source code from IE,
only "Request Search and Rescue!!" is showed up to the client and
That's What I want.

but now, It isn't work suddenly.
Only these code is always remained.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=euc-kr"></HEAD>
<BODY></BODY></HTML>

Why Response.Write() does not work?
 
M

Marshal Antony

Hi Wootaek,
By looking at the code you provided I found that you have
AutoEventWireup="false" in your aspx page.
In this case you need to manually hook up events to the event handler.So you
must override the Oninit function and you must
override a new delegate for the Page_Load event handler.
So inside your class add this :
override protected void OnInit(EventArgs e){
this.Load+=new
System.EventHandler(this.Page_Load);
}

When AutoEventWireup="true" ASP.NET page Framework can
automatically raise events.

Hope this helps,
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top