GoogleMap with UpdatePanel and server side events - help

Apr 17, 2008 at 3:17 PM
I have the following code:

Default.aspx:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<artem:GoogleMap ID="myGoogleMap" runat="server" Width="800px" Height="500px" Latitude="35" Longitude="20"
Zoom="4" EnableScrollWheelZoom="true">
</artem:GoogleMap>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1OnClick" />
</ContentTemplate>
</asp:UpdatePanel>

Default.aspx.cs:

myDataContext db;

protected void Page_Load(object sender, EventArgs e)
{
myGoogleMap.DataLatitudeField = "poiLatitude";
myGoogleMap.DataLongitudeField = "poiLongitude";
myGoogleMap.DataTextField = "poiDescription";
}


protected void Button1OnClick(object sender, EventArgs e)
{
db = new myDataContext(ConfigurationManager.ConnectionStrings"myConnectionString".ConnectionString);
db.Connection.Open();

var hfp= from l in db.Pois
where l.poiLatitude < myGoogleMap.Bounds.NorthEast.Latitude && l.poiLatitude > myGoogleMap.Bounds.SouthWest.Latitude &&
l.poiLongitude < myGoogleMap.Bounds.NorthEast.Longitude && l.poiLongitude > myGoogleMap.Bounds.SouthWest.Longitude
select new { l.poiName, l.poiAddress, l.poiDescription, l.poiLatitude, l.poiLongitude };

myGoogleMap.Markers.Clear();
myGoogleMap.DataSource = hfp.ToList();
myGoogleMap.DataBind();
}

When I click the Button1 I have the functionality I want. My problem is that I want this functionality without somebody have to click the Button1, instead I would like to have this functionality when the moveend or zoomend events occur. Is there any way to have this functionality with server side events.


Using the following code:

Default.aspx:
function __tmpOnClientClick(overlay, point)
{ }

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<artem:GoogleMap ID="myGoogleMap" runat="server" Width="800px" Height="500px" Latitude="35" Longitude="20"
Zoom="4" EnableScrollWheelZoom="true" OnClientClick="__tmpOnClientClick" OnDragEnd="Button1OnClick">
</artem:GoogleMap>
</ContentTemplate>
</asp:UpdatePanel>

my map control reset to default settings ( Latitude="35" Longitude="20" ) on DragEnd event.




In addition I noticed that when I have only one server side event without one client side, like the following:
<artem:GoogleMap ID="myGoogleMap" runat="server" Width="800px" Height="500px" Latitude="35" Longitude="20"
Zoom="4" EnableScrollWheelZoom="true" OnDragEnd="Button1OnClick">

The debugger break at this point: var myGoogleMap_Map = new Artem.Web.GoogleMap({"Address":null …………. "GoogleEvents":{,"ServerEvents":[{"Key":"dragend","Handler": ……..});
Coordinator
Apr 21, 2008 at 6:03 PM
Hi,
I'll check out this soon and fix the problem with events' list.

Regards