Integrate google map in SF 4.4

Posted by Community Admin on 03-Aug-2018 08:42

Integrate google map in SF 4.4

All Replies

Posted by Community Admin on 27-Feb-2012 00:00


how can I integrate Google map with multiple locations in my sitefinity 4.4 project.
if anyone knows please help me..
its urgent ....

thanks in advance..

Posted by Community Admin on 27-Feb-2012 00:00

Hi Rakesh,

You could for example built a custom module to store the locations (Title, Description, GeoLocation)

Then you could create a custom widget that initializes a Google Map and the markers. You can do this all from javascript and the only thing you should take care of is to add a array of markers, based on your GeoLocations.

Here is a sample code on how to build an array from code:
private void BuildMarkersArray(IQueryable<ProjectItem> projects)
           var sb = new StringBuilder();
           sb.Append("var markersArray = [];");
           sb.Append("markersArray = [");
           foreach (var item in projects)
               if (!string.IsNullOrEmpty(item.ProjectLocation))
                   // Construct the infowindow content
                   string content = BuildInfoWindowContent(item);
                   sb.Append("['" + item.ProjectLocation + "', '" + content + "'],");
           sb.Remove(sb.Length - 1, 1);
           // Get a ClientScriptManager reference from the Page class.
           ClientScriptManager cs = Page.ClientScript;
           Type cstype = this.GetType();
           string scriptImages = "ScriptImages";
           var sbImages = new StringBuilder();
           sbImages.Append("var imageIcon = '" + Page.ResolveUrl("~/Assets/Images/gmarker.png") + "';");
           sbImages.Append("var imageShadow = '" + Page.ResolveUrl("~/Assets/Images/gmarker-shw.png") + "';");
           if (!cs.IsStartupScriptRegistered(cstype, scriptImages))
               cs.RegisterStartupScript(cstype, scriptImages, sbImages.ToString(), true);
           // Define the name and type of the client scripts on the page.
           string scriptName = "LocationList";
           // Check to see if the startup script is already registered.
           if (!cs.IsStartupScriptRegistered(cstype, scriptName))
               cs.RegisterStartupScript(cstype, scriptName, sb.ToString(), true);

You can find the documentation of the Google Maps API (javascript) here:

If you need any more help, let me know.


Posted by Community Admin on 27-Feb-2012 00:00

Hi Daniel,

Thanks for your replay.Let me try it...

This thread is closed