Re: Changing page bgcolor from code (repost)
- From: "GaryDean" <GaryDean@xxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Mar 2006 17:49:59 -0800
Thanks, that does it. but....
you don't need the Response.Write("<br/>" & mybd.Attributes("onload")),
all that does is put "<br/>mybd_load()" as the first line of the rendered
html.
anyway that solves the problem :)
--
Regards,
Gary Blakely
"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:LT0emIYUGHA.380@xxxxxxxxxxxxxxxxxxxxxxxx
Hi Gary,
Thanks for your followup.
Yes, I did find the problem you mentioned. It is caused by the
runat='server' control's "onload" is always parsed ast server-side event.
Currently I found that we can use code behind to programmatically assign
the client-side onload script handler for the <body runat="server" > ...
e.g:
======================
<script language="javascript">
function mybd_load()
{
alert("mybd_load...");
}
</script>
</head>
<body id="mybd" runat="server" onclick="mybd_load();">
=========================
=====================
Public Class bodyPage
Inherits System.Web.UI.Page
Protected mybd As HtmlGenericControl
...............................
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
mybd.Attributes("onload") = "mybd_load();"
Response.Write("<br/>" & mybd.Attributes("onload"))
End Sub
.......................
=====================
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
.
- Follow-Ups:
- Re: Changing page bgcolor from code (repost)
- From: Steven Cheng[MSFT]
- Re: Changing page bgcolor from code (repost)
- References:
- Changing page bgcolor from code (repost)
- From: GaryDean
- Re: Changing page bgcolor from code (repost)
- From: Juan T. Llibre
- Re: Changing page bgcolor from code (repost)
- From: GaryDean
- Re: Changing page bgcolor from code (repost)
- From: Juan T. Llibre
- Re: Changing page bgcolor from code (repost)
- From: GaryDean
- Re: Changing page bgcolor from code (repost)
- From: Juan T. Llibre
- Re: Changing page bgcolor from code (repost)
- From: Steven Cheng[MSFT]
- Re: Changing page bgcolor from code (repost)
- From: GaryDean
- Re: Changing page bgcolor from code (repost)
- From: Steven Cheng[MSFT]
- Re: Changing page bgcolor from code (repost)
- From: GaryDean
- Re: Changing page bgcolor from code (repost)
- From: Steven Cheng[MSFT]
- Changing page bgcolor from code (repost)
- Prev by Date: Re: Newbe: Redirect and QueryString HELP PLZ
- Next by Date: Re: Javascript to popup ASPX page
- Previous by thread: Re: Changing page bgcolor from code (repost)
- Next by thread: Re: Changing page bgcolor from code (repost)
- Index(es):
Relevant Pages
|