Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何根据图钉查询相关几何体(多边形)?_Javascript_C#_Ajax_Ado.net - Fatal编程技术网

Javascript 如何根据图钉查询相关几何体(多边形)?

Javascript 如何根据图钉查询相关几何体(多边形)?,javascript,c#,ajax,ado.net,Javascript,C#,Ajax,Ado.net,我想从具有几何和地理信息的SQL表中查询数据,例如具有属性id、名称、纬度、长度和多边形的对象表 我已经用ajax实现了查询,该查询提供了城市的lat和long信息。同时,我希望使用ajax也能获得多边形属性 以下是我的部分代码: var map = (function() { var bingMap = null; var mapElementID = "myMap"; var key = "API_KEY"; function addPin(coords) { va

我想从具有几何和地理信息的SQL表中查询数据,例如具有属性id、名称、纬度、长度和多边形的对象表

我已经用ajax实现了查询,该查询提供了城市的lat和long信息。同时,我希望使用ajax也能获得多边形属性

以下是我的部分代码:

var map = (function() {
  var bingMap = null;
  var mapElementID = "myMap";
  var key = "API_KEY";

  function addPin(coords) {
    var location = new Microsoft.Maps.Location(coords[1], coords[2]);
    var pushpin = new Microsoft.Maps.Pushpin(location);
    pushpin.setOptions({ text: coords[0] });

    bingMap.entities.push(pushpin);
  }
  function addCityPins() {
    for (var city = 0; city < grid.cpCities.length; city++) {
      addPin(grid.cpCities[city]);
    }
  }

  function createMap() {
    if (bingMap) bingMap.dispose();

    var mapOptions = {
      credentials: key,
      center: new Microsoft.Maps.Location('41.6000', '21.7000'),
      mapTypeId: Microsoft.Maps.MapTypeId.road,
      zoom: 9
    };
    bingMap = new Microsoft.Maps.Map(
      document.getElementById(mapElementID),
      mapOptions
    );
    bingMap.entities.clear();
    addCityPins();
  }
  return {
    createMap: createMap
  };
})();
// ]]>
</script>
var-map=(函数(){
var bingMap=null;
var maplementid=“myMap”;
var key=“API_key”;
函数addPin(coords){
var location=new Microsoft.Maps.location(coords[1],coords[2]);
var pushpin=新的Microsoft.Maps.pushpin(位置);
setOptions({text:coords[0]});
bingMap.entities.push(图钉);
}
函数addCityPins(){
对于(var city=0;city

protectedvoid ASPGridView1\u CustomJSProperties(对象发送者,Web.ASPGridViewClientJSPropertiesEventArgs e)
{
字符串[][]城市=新字符串[ASPxGridView1.VisibleRowCount][];
对于(int r=0;r(string)o.ToArray();
}
e、 房地产[“cpCities”]=城市;
}

有人用c#、javascript和sqldatasource实现过这种功能吗
protected void ASPGridView1_CustomJSProperties(object sender, Web.ASPGridViewClientJSPropertiesEventArgs e)
{
    String[][] cities = new String[ASPxGridView1.VisibleRowCount][];

    for (int r = 0; r < ASPxGridView1.VisibleRowCount; r++)
    {
        Object[] dr = ASPxGridView1.GetRowValues(r, "City", "Latitude", "Longitude") as Object[];
        cities[r] = dr.Select(o => (string)o).ToArray();
    }
    e.Properties["cpCities"] = cities;
}