Google地图缩放更改了事件未触发

时间:2014-05-14 11:26:05

标签: c# javascript asp.net google-maps google-maps-api-3

我已从以下链接下载代码

http://www.codeproject.com/Articles/291499/Google-Maps-API-V-for-ASP-NET

但Zoom Changed事件未触发。这里的片段

代码文件

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

    GoogleMapForASPNet1.ZoomChanged += new GoogleMapForASPNet.ZoomChangedHandler(OnZoomChanged);
    if (!IsPostBack)
    {

        //You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html
        //For samples to run properly, set GoogleAPIKey in Web.Config file.
        GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];

        //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
        GoogleMapForASPNet1.GoogleMapObject.Width = "700px"; // You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet1.GoogleMapObject.Height = "400px";            
    }
}
//Add event handler for PushpinDrag event
void OnZoomChanged(int pZoomLevel)
{
    //pID is ID of pushpin which was moved.
    lblZoomLevel.Text = pZoomLevel.ToString();
}
}  

设计

<div>
    <uc1:GoogleMapForASPNet ID="GoogleMapForASPNet1" runat="server" />
<div/>

0 个答案:

没有答案