English 中文(简体)
页: 1 管制
原标题:Google Maps V3 Using Reimer ASP.NET Control

I m using the ASP.NET control from reimers.dk and I was able to view the map, add zoom/pan controls. Panning and zooming work fine from within the map. My problem is getting the map to center on a point sent from ASP.NET, like from a button click. There is no effect or change to the map. Any help with this is appreciated.

Here is the page and code behind:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>


<%@ Register assembly="Reimers.Google.Map" namespace="Reimers.Google.Map" tagprefix="Reimers" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>


                        <asp:Button ID="Button1" runat="server" onclick="Button1_Click"  Text="Button" />


                <Reimers:Map ID="Map1" runat="server" Width="600" Height="400" DefaultMapType="Terrain">
    <Center Latitude="51.477" Longitude="0.0" />

</Reimers:Map>     

      </ContentTemplate>
                </asp:UpdatePanel>

    </form>
</body>
</html>

//////////////////////////////////////

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Map1.MapControls.Add(new Reimers.Google.Map.Controls.ZoomControl());
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Map1.SetCenter(new Reimers.Google.Map.LatLng(27, -82));

    }
}

我也尝试了,没有这种控制。 我得出同样的结果。

Thank you in advance.

问题回答

It took me some time to figure this out. This code works for me to set the center in the Page_Load method:

LatLng laln = new LatLng();
laln.Latitude = 65;
laln.Longitude = -19;
Map1.Center = laln;




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签