title: How to set the value for textbox with javascript on an ASP.NET
body: <p>I need to set up asp textbox with a value from javascript input.</p>
  
  <p>i have here:</p>
  
  <pre><code>&lt;td &gt;&lt;asp:TextBox ID="AddressTextBox" runat="server" Text='&lt;%# Bind("Address") %&gt;' ClientIDMode="Static" /&gt;
                      &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                          ControlToValidate="AddressTextBox" ErrorMessage="*" 
                          ValidationGroup="InsertCustomer" SetFocusOnError="True"&gt;&lt;/asp:RequiredFieldValidator&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>I use autocomplete address form from <a href="https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform" rel="nofollow">here</a></p>
  
  <p>so i placed this to the javascript code:</p>
  
  <pre><code>var src = document.getElementById("autocomplete");
  var dst = document.getElementById("AddressTextBox");
  </code></pre>
  
  <p>and this to function fillInAddress()  funcion:</p>
  
  <pre><code>function fillInAddress() {
          // Get the place details from the autocomplete object.
          var place = autocomplete.getPlace();
  
          for (var component in componentForm) {
            document.getElementById(component).value = '';
            document.getElementById(component).disabled = false;
  
          dst.value = src.value;
          }
  </code></pre>
  
  <p>Im trying to get the full address from the autocomplete to the AddressTextBox field as soon as the address is selected.</p>
  
  <p>But im getting an error that AddressTextBox "The name 'AddressTextBox' does not exist in the current context"</p>
  
  <p>Any ideas? thanks.</p>