我正在尝试将 iFrame(在页面加载时)中的 Google 地图与数据库值绑定:
<iframe id="myMap" runat="server" width="291" height="241" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src=""></iframe><br /><small><a href="https://maps.google.co.in/?ie=UTF8&t=m&ll=21.125498,81.914063&spn=14.315343,18.676758&z=5&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a><br />
我正在使用下面的代码,但我在 iFrame 中得到的只是一个空白框:
public void GetMapDetails(int Propertyid){
DataSet dstPropMap = Tbl_PropertyMaster.GetPropertyDetailsbyId(Propertyid);
if (dstPropMap.Tables[0].Rows.Count > 0)
{
lat = dstPropMap.Tables[0].Rows[0]["Latitude"].ToString();
lon = dstPropMap.Tables[0].Rows[0]["Longitude"].ToString();
myMap.Attributes.Add("src", "https://maps.google.co.in/?ie=UTF8&t=m&ll=" + lat + "," + lon + "&spn=" + lat + "," + lon + "amp;z=5&output=embed");
DataBind();
}
}