日期:2014-05-17 浏览次数:20458 次
function maker(){ map.clearOverlays(); var x = "<%=longitude%>"; var y = "<%=latitude %>"; alert(x); alert(y); var marker = new BMap.Marker(new BMap.Point(x,y)); // 创建标注 map.addOverlay(marker); // 将标注添加到地图中 var infoWindow = new BMap.InfoWindow("欢迎光临"); // 创建信息窗口对象 marker.addEventListener("click", function(){ this.openInfoWindow(infoWindow);}); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "biaozhu") { sqlid = e.CommandArgument.ToString();//获取id } try { string sql = "select longitude,latitude from SYS_LL where id=" + sqlid; DataSet ds = sqlHelper.getDataSet(sql); int count = 0; foreach (DataRow dr in ds.Tables[0].Rows) { Longitudes[count] = System.Double.Parse(dr["Longitude"].ToString()); longitude += Longitudes[count] ;//将读取的经纬度存储为字符串形式 Latitudes[count] = System.Double.Parse(dr["Latitude"].ToString()); latitude += Latitudes[count];//将读取经纬度存储为字符串形式 count = count + 1; } } catch (Exception ee) { Response.Write(ee.Message); } ClientScript.RegisterStartupScript(GetType(), "onclick", "<script>maker();</script>"); }