Re: Changing page bgcolor from code (repost)

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.





.



Relevant Pages

  • Re: Instantly disable a server side asp.net button?
    ... > Private Sub Page_Load(ByVal sender As System.Object, ... > Protected disableMe As Boolean = False ... >> function gets called, and it hides the aspnetbutton, and makes the html ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Where do I start?
    ... it parses the HTML for you. ... Private WithEvents ie As WebBrowser ... Private Sub Form1_Load(ByVal sender As System.Object, ... Dim oElementCollection As HtmlElementCollection ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Automating dialog with web server from VB.NET
    ... > windows in an HTML page inside the control by using the IOleContainer ... We need to declare some interface. ... We use the WebBrowser control to load the html file we get from the ... > Private Sub AxWebBrowser1_DownloadComplete(ByVal sender As Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Instantly disable a server side asp.net button?
    ... > Private Sub Page_Load(ByVal sender As System.Object, ... > Protected disableMe As Boolean = False ... >> function gets called, and it hides the aspnetbutton, and makes the html ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: FCKEditor and ASP.NET
    ... HTML I-Frame object and, subsequently, use it as an HTML editor. ... I can register client-side script with the "behind code" for each ASPX ... Private Sub ClientScriptFCKActivate() ... 'Register _JavaScript block for Search Incident button ...
    (microsoft.public.dotnet.framework.aspnet)