Javascript 我正在获取InvalidValueError:setCenter:不是一个LatLng或具有有限坐标的LatlInTerral:在属性中lat:NaN不是一个可接受的值

Javascript 我正在获取InvalidValueError:setCenter:不是一个LatLng或具有有限坐标的LatlInTerral:在属性中lat:NaN不是一个可接受的值,javascript,c#,html,Javascript,C#,Html,我已经尝试了与“error:js?sensor=false:71 InvalidValueError:setCenter:不是具有有限坐标的LatLng或Latlngileral:在属性lat:NaN中不是可接受的值”相关的所有StackOverflow解决方案。问题仍然存在, 这是我的Javascript代码,控制台中的错误没有指定行 <script type="text/javascript" src="http://ajax.googleapis

我已经尝试了与“error:js?sensor=false:71 InvalidValueError:setCenter:不是具有有限坐标的LatLng或Latlngileral:在属性lat:NaN中不是可接受的值”相关的所有StackOverflow解决方案。问题仍然存在, 这是我的Javascript代码,控制台中的错误没有指定行

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script src="http://maps.google.com/maps/api/js?sensor=false"></script>




    <script type="text/javascript">
    function initialize() {
        
        var markers = JSON.parse('<%=ConvertDataTabletoString() %>');
        var mapOptions = {
            center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
            zoom: 5,
            mapTypeId: google.maps.MapTypeId.ROADMAP

            //  marker:true
        };
        var infoWindow = new google.maps.InfoWindow();
        var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
        for (i = 0; i < markers.length; i++) {
            var data = markers[i]
            var myLatlng = new google.maps.LatLng(data.lat, data.lng);
            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: data.title
            });
            (function (marker, data) {

                // Attaching a click event to the current marker
                google.maps.event.addListener(marker, "click", function (e) {
                    infoWindow.setContent(data.description);
                    infoWindow.open(map, marker);
                });
            })(marker, data);
        }
    }
    </script>
    </head>

    <body onload="initialize()">  

函数初始化(){
var markers=JSON.parse(“”);
变量映射选项={
中心:新建google.maps.LatLng(标记[0].lat,标记[0].lng),
缩放:5,
mapTypeId:google.maps.mapTypeId.ROADMAP
//马克:对
};
var infoWindow=new google.maps.infoWindow();
var map=new google.maps.map(document.getElementById(“map_canvas”),mapOptions);
对于(i=0;i
这是我的控制器

public partial class LocationMapTest_2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       

    }
    public string ConvertDataTabletoString()
    {
        
        string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(constr);
        SqlCommand cmd = new SqlCommand("SELECT Latitude, Longitude, Title FROM Article", conn);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
        Dictionary<string, object> row;
        foreach (DataRow dr in dt.Rows)
        {
            row = new Dictionary<string, object>();
            foreach (DataColumn col in dt.Columns)
            {
                row.Add(col.ColumnName, dr[col]);
            }

            rows.Add(row);
           //Response.Write(serializer.Serialize(rows).ToString());

        }
        return serializer.Serialize(rows);
    }

}
public分部类LocationMapTest_2:System.Web.UI.Page
{
受保护的无效页面加载(对象发送方、事件参数e)
{
}
公共字符串ConvertDataTabletoString()
{
string constr=ConfigurationManager.ConnectionString[“ConnectionString”].ConnectionString;
SqlConnection conn=新的SqlConnection(cont);
SqlCommand cmd=新的SqlCommand(“从文章中选择纬度、经度、标题”,conn);
SqlDataAdapter da=新的SqlDataAdapter(cmd);
DataTable dt=新的DataTable();
da.填充(dt);
System.Web.Script.Serialization.JavaScriptSerializer serializer=新的System.Web.Script.Serialization.JavaScriptSerializer();
列表行=新列表();
字典行;
foreach(数据行dr在dt.行中)
{
行=新字典();
foreach(dt.列中的数据列列列)
{
行添加(列名称,dr[col]);
}
行。添加(行);
//Write(serializer.Serialize(rows.ToString());
}
返回序列化程序。序列化(行);
}
}

这看起来不像asp.net核心。这看起来像asp.net core中从未提供过的web表单。这看起来不像asp.net core。这看起来像是asp.net核心中从未提供过的web表单。