I am new with MVC so forgive my ignorance. What I have is a Google maps script, which will dynamically change the marker location based on user page. In web forms I can write the script in code behind like so:
protected void maps_wrapper_Init(object sender, EventArgs e)
{
maps_wrapper.Text = "<script> " +
"function initialize() {" +
"var mapOptions = {" +
"zoom: 12," +
"center: new google.maps.LatLng(-25.363882, 131.044922)," +
"mapTypeId: google.maps.MapTypeId.SATELLITE" +
"};" +
"var map = new google.maps.Map(document.getElementById('map-canvas')," +
" mapOptions);" +
"var image = 'img/mapMarker.png';" +
"var marker = new google.maps.Marker({" +
"position: map.getCenter()," +
"map: map," +
"title: 'Click to zoom'," +
"icon: image" +
"}); " +
"google.maps.event.addListener(map, 'center_changed', function() {" +
"window.setTimeout(function() {" +
"map.panTo(marker.getPosition());" +
"}, 3000);" +
"});" +
"google.maps.event.addListener(marker, 'click', function() {" +
"map.setZoom(18);" +
"map.setCenter(marker.getPosition());" +
"});" +
"}" +
"google.maps.event.addDomListener(window, 'load', initialize);" +
"</script> ";
}
and call it with a label
<asp:Label runat="server" ID="map_wrapper" OnInit="search_wrapper_Init" />
How would you do this equivalent in MVC?
Or am I heading in completely the wrong direction?