title: SearchBox Google Maps not working C# MVC 3
body: <p>I'm trying to use Google Maps SearchBox using MVC 3 and C # and is giving error. The example I'm using is this:</p>
  
  <p><a href="https://developers.google.com/maps/documentation/javascript/examples/places-searchbox" rel="nofollow">https://developers.google.com/maps/documentation/javascript/examples/places-searchbox</a>
  The problem is this line:</p>
  
  <pre><code>var input = /** @type {HTMLInputElement} */(document.getElementById('target'));
  </code></pre>
  
  <p>It´s error:</p>
  
  <pre><code>Server Error in '/' Application.
  
  Compilation Error
  
  Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
  
  Compiler Error Message: CS0103: The name 'type' does not exist in the current context
  
  Source Error:
  
  
  Line 55:                 
  Line 56:         /*var input = jQuery.type(document.getElementById('endereco'));*/
  Line 57:         var input = /** @type {HTMLInputElement} */(document.getElementById('target'));
  Line 58:         var searchBox = new google.maps.places.SearchBox(input);
  Line 59:         var markers = [];
  
  Source File: n:\Desenvolvimento\Projetos\TCC\TCC\Views\Posicionador\Index.cshtml    Line: 57 
  </code></pre>
  
  <p>I tried to trade for:</p>
  
  <pre><code>var input = jQuery.type(document.getElementById('endereco'));
  </code></pre>
  
  <p>It's error:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'SearchBox' of undefined 
  </code></pre>
  
  <p>Full code is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var map;
      var marker1;
      var marker2;
      var rulerpoly; 
      var iw = new google.maps.InfoWindow(); // Global declaration of the infowindow
      var latlngFURBTV = new google.maps.LatLng(-26.905,-49.05694);
      var markers = [];
  
  
  
      $(document).ready(function () {
          $("#abrirmapa").click(function() { initialize(); });
          $("#centralizarFURBTV").click(function() { centralizarFURBTV(); });
          $("#limpar").click(function () { limpar(); });
          $("#grafico").click(function () { grafico(); });
          $("#salvar").click(function () { salvar(); });
          $("#posicaoautomatica").click(function () { posicaoautomatica(); });
          $("#cmdLocal").click(function () { cmdLocal(); });
          $("#cmdTorre").click(function () { cmdTorre(); });     
  
          $(".knob").knob({
              'min': 30,
              'max':150,
              'angleOffset':0,
              'angleArc': 180,
              'readOnly':true
  
          });         
      });
  
      function initialize() {
          var mapOptions = {
              center: new google.maps.LatLng(-26.88135, -49.06039),
              zoom: 15,
              mapTypeId: google.maps.MapTypeId.ROADMAP /*google.maps.MapTypeId.TERRAIN*/
          };
          map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
  
          google.maps.event.addListener(map, 'click', function (event) {
              clique_mapa(event.latLng);
          });
  
          marker1 = undefined;
          marker2 = undefined;
          rulerpoly = undefined; 
  
          //GEOCODER
          geocoder = new google.maps.Geocoder();
  
          marker = new google.maps.Marker({
              map: map,
              draggable: true
          });
  
          var input = jQuery.type(document.getElementById('endereco'));        
          var searchBox = new google.maps.places.SearchBox(input);
          var markers = [];
  
          google.maps.event.addListener(searchBox, 'places_changed', function() {
            var places = searchBox.getPlaces();
  
            for (var i = 0, marker; marker = markers[i]; i++) {
              marker.setMap(null);
            }
  
            markers = [];
            var bounds = new google.maps.LatLngBounds();
            for (var i = 0, place; place = places[i]; i++) {
              var image = {
                url: place.icon,
                size: new google.maps.Size(71, 71),
                origin: new google.maps.Point(0, 0),
                anchor: new google.maps.Point(17, 34),
                scaledSize: new google.maps.Size(25, 25)
              };
  
              var marker = new google.maps.Marker({
                map: map,
                icon: image,
                title: place.name,
                position: place.geometry.location
              });
  
              markers.push(marker);
  
              bounds.extend(place.geometry.location);
            }
  
            map.fitBounds(bounds);
          });
  
          google.maps.event.addListener(map, 'bounds_changed', function() {
              var bounds = map.getBounds();
              searchBox.setBounds(bounds);
          });
      }
  &lt;/script&gt;
  
  @{
      ViewBag.Title = "Posicionador";
  }
  
  
  &lt;div class="linha"&gt;
      &lt;div class="coluna" style="width:160px"&gt;
          Dados Antena FURB TV
      &lt;/div&gt;
      &lt;div class="coluna" style="width:152px"&gt;Lat: 26° 54' 18'' S&lt;/div&gt;
      &lt;div class="coluna" style="width:152px"&gt;Lng: 49° 03' 25'' O&lt;/div&gt;        
  &lt;/div&gt;
  
  &lt;div class="linha"&gt;
      &lt;div class="coluna" style="width:160px"&gt;&amp;nbsp;&lt;/div&gt;
      &lt;div class="coluna" style="width:152px"&gt;Lat: -26,905&lt;/div&gt;
      &lt;div class="coluna" style="width:152px"&gt;Lng: -49,05694&lt;/div&gt;        
  &lt;/div&gt;
  
  &lt;div class="clear"&gt;&lt;br /&gt;&lt;/div&gt;
  
  
  &lt;div class="coluna2"&gt;
      &lt;div id="map_canvas" style="width:100%; height:400px; "&gt;&lt;/div&gt;
      &lt;div class="demo-container"&gt;
          &lt;div id="placeholder" class="demo-placeholder"&gt;&lt;/div&gt;
      &lt;/div&gt;    
  &lt;/div&gt;
  </code></pre>