Hi,
you can add the following code in your page to create an array also
you can edit this code to add your on logic for assigning the values in to
the array.
Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
' Put user code to initialize the page here
Me.RegisterStartupScript("SetFocusScript",
PopulateJavaScriptArray())
End Sub
Private Function PopulateJavaScriptArray() As String
' Declaring the Number of Items in the Array
Dim noOfItems As Integer = 10
Dim myJavaScript As StringBuilder = New StringBuilder()
myJavaScript.Append("<script language='Javascript'>")
myJavaScript.Append(" var myArrayInJavaScript = new Array("+
noOfItems +");")
myJavaScript.Append(" myArrayInJavaScript[5] ='Hello
There...!!';")
myJavaScript.Append(" alert(myArrayInJavaScript[5]);")
myJavaScript.Append("</script>")
Return myJavaScript.ToString()
End Function
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.