Decent articles for MVC 4 Authentication

MVC 4 Authentication

It is about SimpleMembership, WebSecurity, RememberMe, and other security matters in MVC 4.

Recommended.

 

Advertisements

How to put Multiple Markers in Google Map in MVC 4

source article: http://blog.myitside.com/post/2012/01/20/How-to-use-Google-Maps-with-multiple-markers-in-ASPNET-MVC-3.aspx

* In my Controller, 
  public ActionResult Map()
  {
    IEnumerable<Place> places = getAllPlaces();
    return View(places);
  }  

* In Map.cshtml razor view, 

@model IEnumerable<Place>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markermanager/src/markermanager.js"></script>

<script language="javascript" type="text/javascript">
   var map;    
   var mgr;    
   function initialize() {
        var myOptions = {
            zoom: 2,
            center: new google.maps.LatLng(0, 0),
            mapTypeId: google.maps.MapTypeId.HYBRID
        };
        map = new google.maps.Map(document.getElementById("googleMap"), myOptions);
        mgr = new MarkerManager(map);
        var infoWindow = new google.maps.InfoWindow({ content: "contents" });
        google.maps.event.addListener(mgr, 'loaded', function () {
            @foreach (var place in Model) {
                <text>
                var marker = new google.maps.Marker({
                    position: new google.maps.LatLng(@place.Latitude, @place.Longitude),
                    html: "@place.Link"
                });

                google.maps.event.addListener(marker, "click", function () {
				    infoWindow.setContent(this.html);
				    infoWindow.open(map, this);
			    });

                mgr.addMarker(marker, 0);
                </text>
            }
            mgr.refresh();
        });
    }
    google.maps.event.addDomListener(window, 'load', initialize);
</script>

<div id="googleMap"></div>