Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:32:20+00:00 2026-05-31T06:32:20+00:00

I have a script built from code behind in asp .net. It works fine

  • 0

I have a script built from code behind in asp .net. It works fine but just display first 11 markers on the map out of 200. It throws error saying ‘0’ is null or not an object for the 12th address. Even after I removed 12th address and it still behaves the same. All the physical address from the database is also valid. I have 200 such addresses. I am using google map api v3. Thanks in advance for any help. Here is the method I used to build the script:

 private void MapScript(DataSet ds)
    {
        StringBuilder sb = new StringBuilder();
        string itemList = string.Empty;
        foreach (DataRow r in ds.Tables[0].Rows)
        {
            // bypass empty rows        
            if (r["Address"].ToString().Trim().Length == 0)
                continue;
            sb = sb.Append("'" + r["Address"].ToString().Trim() + "',");               
        }
        if (sb.Length > 0)
        {
            itemList = sb.ToString().Substring(0, sb.ToString().Length - 1);
            itemList = itemList.Replace("\n", " ");
        }
        //script
        script.Text = @"<script type='text/javascript'>                            
                       window.onload = function() {  
                            var temp = [" + itemList + @"];
                            var latlng = new google.maps.LatLng(32.802955, -96.769923);  
                            var options = {  
                            zoom: 10,
                            center: latlng,
                            mapTypeId: google.maps.MapTypeId.ROADMAP
                            };  
                            var map = new google.maps.Map(document.getElementById('map_canvas'), options);      
                            var geocoder = new google.maps.Geocoder();

                            for (var i = 0; i < temp.length; i++) {
                            (function(address) {
                                geocoder.geocode({
                                    'address': address
                                }, function(results) {
                                    var marker = new google.maps.Marker({
                                        map: map,
                                        position: results[0].geometry.location,
                                        title: address
                                    });                                       
                                });
                            })(temp[i]);
                           }
                        }                           
                        </script> ";             
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:32:21+00:00Added an answer on May 31, 2026 at 6:32 am

    You are getting the error '0' is null or not an object because you are not checking the status of the request before you try to set the position attribute of the marker. Like @david said the status returned is probably OVER_QUERY_LIMIT.

    This is how I have handled this during testing. Basically, it checks the returned status and if the status is over the limit, it will wait for 200 milliseconds and try again. I have only used this in a test environment since the client had a premier account that was not subject to the limits. 200 milliseconds seems to be the sweet spot right now, but Google has changed the limits on how many requests can be made a second in the past.

    Here is a fiddle of it working

    function Geocode(address) {
        geocoder.geocode({
            'address': address
        }, function(results, status) {
            if (status === google.maps.GeocoderStatus.OK) {
                //update finished count so we know which markers are done.
                finishedCount++;
                UpdateProgress();
                var result = results[0].geometry.location;
                var marker = new google.maps.Marker({
                    position: result,
                    map: map
                });     
                bounds.extend(marker.position);
            } else if (status === google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
                setTimeout(function(){
                    //retry
                     Geocode(address);   
                }, 200);
            }else{
                alert("Geocode was not successful for the following reason: " 
                     + status);
            }
        });
    }
    
    function UpdateProgress(){          
         var progress = Math.round((finishedCount / citiesInTexas.length) * 100);
        $('#progress').text("percent done: " + progress);
    
        if(progress === 100)
            map.fitBounds(bounds);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python script that uses built-in modules but also imports a number
I'm currently experimenting with build script, and since I have an ASP.net Web Part
I have an ASP.NET MVC page that has left Menu Navigation that is built
I have a utility build script that gets called from a variety of project-specific
I have an ant build script that needs to pull files down from a
I have a problem. I built a script to make a request to an
I have built an object in Javascript on the Google Apps Script engine and
I've been using Boost as a framework built from Pete Goodliffe's script for quite
I have a question i wrote a powershell script so i have name.ps1, but
I have a requirement where users should be able to navigate from the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.