Johnrad
Johnrad

Reputation: 2655

How can I call a javascript function at the end of a vb.net Sub?

How can I call a javascript function at the end of a vb.net S

Upvotes: 0

Views: 205

Answers (3)

ItsPronounced
ItsPronounced

Reputation: 5463

If you are trying to do what I think you are, you can use Page.RegisterStartupScript

Dim Script As String = “<script language=javascript” id=’myClientScript’>myFunction();</script>”
Page.RegisterStartupScript(“callTest”,Script)

Upvotes: 0

NoAlias
NoAlias

Reputation: 9193

Check out the RegisterClientScriptBlock Method of the ClientScriptManager class.

Upvotes: 0

Jonathan Wood
Jonathan Wood

Reputation: 67335

If your VB.NET subroutine is running on the server, and you want the JavaScript to run on the client, you can't.

The only way you can come close is by having your VB.NET subroutine construct some appropriate JavaScript in the page being served such that the JavaScript will run when it's loaded.

Upvotes: 2

Related Questions