We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Update Google map through WCF Ajax Service

Medium Priority
Last Modified: 2013-11-19

We have scenario in project to update google map through WCF AJAX service.

1. On a aspx page I have checkbox list to filter, search results and based on search result location google map shows locations.

2. When I select checkbox to filter, search result updates and google map should also get updated.

3. Google map is not updating.

Source Code:

On checkbox selection,
var CurrentPage;
function RetrieveDiscounts(currentLocationId, discountDateRanges, pageNumber) {

                                currentLocationId, null, discountDateRanges, discountDateRanges, DiscountItems, VenueTypes, DiscountKeyword, VenueKeyword, MinValue, pageNumber,
                                PageSize, SortOrder, DiscountType, OtherDiscountType, isDisountCard, VenueName, VenueAddress, state, city, venuedistance, 1, onFindDiscountsComplete, onFindDiscountsError)

Ajax service source code:
        public string[] FindValidDiscounts(int locationId, GeoLocation userLocation, DateTime discountStartDate, DateTime discountEndDate, IEnumerable<int> discountItemIds,
                                    IEnumerable<int> venueTypesIds, string discountKeyword, string venueKeyword, double minDiscountValue, int pageNumber, byte pageSize,
                                    DiscountSearchOrder orderBy, IEnumerable<int> DiscountType, IEnumerable<int> DiscountOtherType, int Iscard, string VenueName, string VenueAddess, string State, string City, string venuedistance, Int32 isTrue)

Page pageHolder = new Page();
Map omap = (Map)pageHolder.LoadControl("~/_Parts/utility/Map.ascx");
int VenueCounter = 0;
            foreach (SearchResult oSearchResult in oDiscountSearchResponse.SearchResults)
                VenueCounter += 1;
                omap.AddLocation(oSearchResult.Venue.GeoLocation.Latitude, oSearchResult.Venue.GeoLocation.Longitude, VenueCounter, "");

string[] str = new string[5];

            omap.SetCenter(72.12, 72.19);
            omap.ZoomLevel = 10;

            StringWriter Mapoutput = new StringWriter();
            HttpContext.Current.Server.Execute(pageHolder, Mapoutput, false);
            str[0] = Mapoutput.ToString();

            return str;


When AJAX call completes

//ajax success
function onFindDiscountsComplete(results, context, methodName) {

   document.getElementById('MapContainer').innerHTML = results[0];


MapContainer is div tag on aspx page.
Our problem is that google map is not refreshing on ajax call.

Can any one give great thoughts over it?

Best Regards,
Watch Question

why don't you use Google Maps API toolkit, they have excellent functionalities.


We have architecute like that and we need to follow this only. Do you have your great suggestions?


Yes, I found the answer myselft for this and I will update when I will be in the office.
Unlock this solution and get a sample of our free trial.
(No credit card required)


Found solution myself and I hope that it will helpful
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.