add google map "Uncaught Type Error: Cannot read property 'style' of null"
<p>I am trying to add a Google map to my web page using asp.net.  Using the code which is given below the Google map shows for a few milliseconds and then disappears.  I inspected the elements in console and the following message is displayed - "Uncaught Type Error:  Cannot Read property 'style' of  null".  Please guide me to finding a solution to this issue.</p>

<pre><code>&lt;script  type="text/javascript"&gt;
            var directionsDisplay;
            var directionsService = new google.maps.DirectionsService();

            function initialize() {
                directionsDisplay = new google.maps.DirectionsRenderer();
                var mapOptions = {
                    zoom: 7,
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    center: new google.maps.LatLng(41.850033, -87.6500523)
                };
                var map = new google.maps.Map(document.getElementById('map-canvas'),
          mapOptions);
                directionsDisplay.setMap(map);
                directionsDisplay.setPanel(document.getElementById('directions-panel'));

                var control = document.getElementById('control');
                control.style.display = 'block';

    Uncaught TypeError: Cannot read property 'style' of null




                map.controls[google.maps.ControlPosition.TOP_CENTER].push(control);
            }

            function calcRoute() {
                var start = document.getElementById('start').value;
                var end = document.getElementById('end').value;
                var request = {
                    origin: start,
                    destination: end,
                    travelMode: google.maps.TravelMode.DRIVING
                };
                directionsService.route(request, function (response, status) {
                    if (status == google.maps.DirectionsStatus.OK) {
                        directionsDisplay.setDirections(response);
                    }
                });
            }

            google.maps.event.addDomListener(window, 'load', initialize);

        &lt;/script&gt;
</code></pre>
