I am trying to pass the pageIndex variable to my code behind from javascript. The code works if I pass any hardcoded value. However, I can't get it to work using var values.
pageIndex++;
var sPageIndex = pageIndex.toString;
document.getElementById('<%= Label1.ClientID %>').innerHTML = '<%= xDoSomething(sPageIndex)%>';
This works:
document.getElementById('<%= Label1.ClientID %>').innerHTML = '<%= xDoSomething(123456)%>';
This is my simple code behind function:
Public Shared Function xDoSomething(sPageIndex As String) As String
Dim ss As String = sPageIndex
Try
If ss.Length < 1 Then
ss = "smaller than one"
Else
ss = ss
End If
Return "from code behind [" & ss & "]"
Catch ex As Exception
Return ex.ToString
End Try
End Function
It looks like the value I'm trying to pass does not have permissions to be accessed! Any ideas how to fix this?