Google maps 使用db值加载页面时的Google地图绑定

Google maps 使用db值加载页面时的Google地图绑定,google-maps,Google Maps,我正在尝试使用数据库值在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

我正在尝试使用数据库值在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&amp;t=m&amp;ll=21.125498,81.914063&amp;spn=14.315343,18.676758&amp;z=5&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a><br />
好的,我解决了这个问题, 出于某种原因,使用Attributes.Add向IFrame添加属性不起作用,所以我切换到htmlIMG图像,并将runat=“server”标记放在上面

ie

<img id="myMap" runat="server" width="291" height="241"/>
<img id="myMap" runat="server" width="291" height="241"/>
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().Trim();
        lon = dstPropMap.Tables[0].Rows[0]["Longitude"].ToString().Trim();
        myMap.Attributes.Add("src", "http://maps.google.com/maps/api/staticmap?center=" + lat + "," + lon + "&zoom=11&size=291x241&sensor=true");
    }
}