This is a migrated thread and some comments may be shown as answers.

Marker On Click

3 Answers 193 Views
Map
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 01 Sep 2015, 08:18 AM

Is there a way to handle the Marker on Click on a server side event?

I would like to change the contents of other controls on the page using the data obtained from the Marker location.

Thank you,

Nick

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 01 Sep 2015, 01:32 PM

Hello Nick,

RadMap for ASP.NET AJAX is a JavaScript-based widget (it is actually a server wrapper over the Kendo UI Map widget). Thus, it does not offer server-side events. We have facilitated databinding to common datasources, but its primary focus is client-side interaction.

That being said, if changing the page content via JavaScript is not an option, I can suggest the following:

  1. capture the markerClick event (http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/map#events-markerClick)
  2. initiate some form of a server request (http://www.telerik.com/blogs/different-ways-to-make-a-request-to-the-server). For example, an AJAX request through the RadAjaxManager/RadAjaxPanel client-side API (http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/client-side-programming/overview).


Regards,

Marin Bratanov
Telerik
0
Nick
Top achievements
Rank 1
answered on 01 Sep 2015, 01:49 PM

Marin, yes, I already figured it out that I must use the ajaxManager to call the server side function.

That being said, I'm not being able to bind the markerClick event to a javascript function. 

 Assuming I have a simple RadMap as shown below, can you please give me  a sample javascript code to bind the event correctly

        <telerik:RadMap runat="server" ID="rmMain" Zoom="4" CssClass="MyMap" >
            <CenterSettings Latitude="40" Longitude="-100" />
            <DataBindings>
                <MarkerBinding DataShapeField="Shape" DataLocationLatitudeField="Latitude" DataLocationLongitudeField="Longitude" />
            </DataBindings>
            <LayersCollection>
                <telerik:MapLayer Type="Tile" Subdomains="a,b,c"
                    UrlTemplate="http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png"
                    Attribution="&copy; <a href='http://osm.org/copyright' title='OpenStreetMap contributors' target='_blank'>OpenStreetMap contributors</a>.">
                </telerik:MapLayer>
            </LayersCollection>
            <ClientEvents OnLoad="mapLoad" />
        </telerik:RadMap>​

0
Marin Bratanov
Telerik team
answered on 01 Sep 2015, 02:22 PM

Hello Nick,

Since the matter is now about attaching the client-side handler, I would suggest continuing this discussion in the other thread we have: http://www.telerik.com/forums/map-marker-onclick-event-help#zFBvB6RNP0ubaQb8qQEaDw. It provides two additional examples.

Regards,

Marin Bratanov
Telerik
Tags
Map
Asked by
Nick
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Nick
Top achievements
Rank 1
Share this question
or