0

net and wondering if I could get some get help with this problem. The problem im having is i create an array in vb.net onload and trying to use that array in javascript. Is there anyway I can do do this? An example would be very much appreciated.

1
  • 2
    Have you any code you can post? It's a bit like stabbing in the dark otherwise... Commented Aug 2, 2011 at 17:27

2 Answers 2

1

You can print from VB.NET a string with the javascript tag and inside using Var myVariableJsSide1 = ... and then later in the client side use this variable.

Sign up to request clarification or add additional context in comments.

Comments

0

I agree with Daok. Lets assume you want to create an html file with some html and script within.

Dim FILE_NAME As String = "C:\myfile.html"
Dim js As String

js="<script language=javascript>" & _
"my_array=" & my_vb_array & ";" & _
"</script>"

If System.IO.File.Exists(FILE_NAME) = True Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write(js)
objWriter.Close()
MsgBox("Text written to file")
Else
MsgBox("File Does Not Exist")
End If

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.