bug with ispostbck and body tag?

W

Will

Cannot find any mention of this, and this would have to be a fairly
common item so looking for what I am doing wrong or some suggestion on
how to stop it.

In my Page_Load I have the following, ignore mispellings, miscase,etc

Response.Write(IsPostBack);
if (!IsPostBack) {
Response.write("above");
HtmlGenericControl masterPageBodyTag =
(HtmlGenericControl)Page.Master.FindControl("MasterBody");
masterPageBodyTag .Attributes.Add("onLoad","alert('Hi');");
Response.write("below");
}

First time on the page I get my three response.writes,IsPostBack is
False, and my alert. All is good
I hit the a submit button I get the response.write(IsPostBack) of True
and for some reason my alert other two response.write are not there.
Looking at the HTML code there is the onLoad in the <body>

Some other solution to stopping this then adding an else statement and
then setting the onLoad to blank?
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top