"MW" <Please@NoSpam. com> wrote in message
news:u8FvQSaLEH A.4052@TK2MSFTN GP11.phx.gbl...[color=blue]
> How can I poplute a javascript array from vb.net? I would prefer to do[/color]
this[color=blue]
> from codebehind.
>
> Michael
>
>[/color]
Create a String that represents the code and register it as a client script
dim str as String = "<script>va r i=new
Array();i[0]=234;i[1]=543;i[2]=598;</script>"
page.RegisterCl ientScriptBlock (""myScript",st r)
(this method does not show up in intellisense, but you can see it if you
look at the page class through the object browser)
"MW" <Please@NoSpam. com> wrote in message
news:u8FvQSaLEH A.4052@TK2MSFTN GP11.phx.gbl...[color=blue]
> How can I poplute a javascript array from vb.net? I would prefer to do[/color]
this[color=blue]
> from codebehind.
>
> Michael
>
>[/color]
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.EventArg s)
' Put user code to initialize the page here
Me.RegisterStar tupScript("SetF ocusScript",
PopulateJavaScr iptArray())
End Sub
Private Function PopulateJavaScr iptArray() As String
' Declaring the Number of Items in the Array
Dim noOfItems As Integer = 10
Dim myJavaScript As StringBuilder = New StringBuilder()
myJavaScript.Ap pend("<script language='Javas cript'>")
myJavaScript.Ap pend(" var myArrayInJavaSc ript = new Array("+
noOfItems +");")
myJavaScript.Ap pend(" myArrayInJavaSc ript[5] ='Hello
There...!!';")
myJavaScript.Ap pend(" alert(myArrayIn JavaScript[5]);")
myJavaScript.Ap pend("</script>")
Return myJavaScript.To String()
End Function
HTH
Regards
Ashish M Bhonkiya
"MW" <Please@NoSpam. com> wrote in message
news:u8FvQSaLEH A.4052@TK2MSFTN GP11.phx.gbl...[color=blue]
> How can I poplute a javascript array from vb.net? I would prefer to do[/color]
this[color=blue]
> from codebehind.
>
> Michael
>
>[/color]
"MW" <Please@NoSpam. com> wrote in message
news:u8FvQSaLEH A.4052@TK2MSFTN GP11.phx.gbl...[color=blue]
> How can I poplute a javascript array from vb.net? I would prefer to do
> this
> from codebehind.
>
> Michael
>
>[/color]
Comment