body onload set server side

P

Peter Young

Is there a way to set the <body> tag's onload script event from a custom web control's server-side code?

For example, how would you get the HTML to render like this:

....
<body onload="alert('Hello');">
....
 
P

Peter Young

Ken Cox said:
Hi Peter,

Try this?

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Page.RegisterStartupScript _
("start", "<script>alert('Hello');</script>")
End Sub

Thanks Ken. That's what I ended up doing.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top