简体   繁体   中英

How to get codebehind aspx.cs data into javascript?

I have gridview filter data. I have two column longitude and latitude. I want to populate that data on bing map. I already get the Bing map and it works fine but I want multiple longitudes and latitude data to populate on the map. What did I do?

You can get data in javascript from code behind by these methods -

  1. Create a hidden field make it runat="server" so that it can be accessed from code behind and set the value in it from there and then you can access these hidden field values in javascript by document.getElementById("HiddenFieldId").value

  2. Set the values in the cookies from the codebehind and access the values of cookies from javascript

  3. you can also inject Javascript code directly from code behind on the page load using ClientScipt.RegisterStartupScript or ScriptMananger.RegisterStartupScript

There are many other methods please tell me if any of these helped

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM