How To Pass Data From Code Behind To Javascript?
Hi I am having trouble to pass a value from a code behind (onLoad) to javascript. I am able to get the value for the address of the draggable marker(if INITIAL LAT and LONG value d
Solution 1:
Easiest way is to use Literal server control, and pass the value. It is kind of weird, but it works.
var markers = [{
...
"lat": <asp:Literal runat="server" ID="LatLiteral" />,
"lng": <asp:Literal runat="server" ID="LngLiteral" />
}];
Protected Sub Page_Load(sender AsObject, e As EventArgs) Handles Me.Load
LatLiteral.Text = "43.7328831"
LngLiteral.Text = "-79.6784712"
End Sub
Visual Studio
Notice that Visual Studio will complain for syntax error. You can ignore it.
Post a Comment for "How To Pass Data From Code Behind To Javascript?"