Calling DHTML function from code behind event handler

L

Lachlan Gemmell

Hello there,

I'm hoping this is possible but as yet I haven't been able to find out how
to do it.

I have placed a client side VBScript function in the HTML of my ASP.NET
page. Only under certain circumstances I want a server side button click
event handler in my code behind class to trigger a call of that VBScript
function. I understand that the call will not be made at the time the server
side button click event handler but instead will execute later when the page
is rendered on the client.

How do I accomplish this?

Regards,

Lachlan
 
C

Cor

Lachlan,

Try this

\\\needs a button on a webpage
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Me.Button1.Text = "Send Mail"
Me.Button1.Attributes("onClick") = _
"window.location='mailto:[email protected]?subject=Cor demo&body=I hope this
helps?';"
End If
End Sub
///
I hope this helps a little bit?

Cor
 
L

Lachlan Gemmell

Thanks but it wasn't really what I was looking for. I found my solution in
the Page.RegisterClientScriptBlock() method.

Regards,

Lachlan
 
C

Cor

You mean this one?
\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');}
</script>"
RegisterStartupScript("Startup", str)
///
I thought your question had to do with the click event?

Cor
 

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,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top