Code:
Dim Message as string = "Alert Box from Code Behind."
Dim strScript As String = "<script language=JavaScript>"
strScript += "alert(""" & Message & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strScript)
End If
Else take a look at
this example