This is the function at html page:<script language="javascript">
function test()
{
//Add the function code here
}
</script>
To call this javascript function from code behind (.vb), Use Page.RegisterStartupScript
function like the code below:Dim strScript As String = "<script language='javascript' id='myClientScript'>test();</script>"
Page.RegisterStartupScript(“callTest”,strScript)
Thursday, March 20, 2008
Calling Javascript Function from Code Behind (.vb)
Posted by Wec at 5:10:00 PM
Labels: .NET Programming, ASP .NET 1.1, VB.NET
Subscribe to:
Post Comments (Atom)
3 comments:
a simple yet helpful piece of code...tnx a lot.
I don't get it...when I enter the same code in file xxx.aspx.vb visual studio gives me an error. It doesn't take well "<-/-script>" even if it is inside double quotes. I can't figure out how come you guys dont have the same error.
Very good, a simple and very helpful code . . . thanks a lot
Post a Comment