This example shows how to databind Googlemap Control for ASP.NET MVC.
The required steps are:
public ActionResult DataBindingToModel()
{
IEnumerable<MarkerData> data = DataContext.GetRegions();
return View(data);
}
@( Html.Googlemap()
.Name("map")
.BindTo<DataContext.MarkerData, Marker>
(Model, mappings =>
{
mappings.For<DataContext.MarkerData>(binding => binding
.ItemDataBound(marker, obj) =>
{
marker.Latitude = obj.Latitude;
marker.Longitude = obj.Longitude;
marker.Title = obj.Title;
marker.zIndex = obj.zIndex;
})
);
})
)