title: How to get selected value from dropdownlist in asp.net using Javascript?
body: <p>I am populating country dropdownlist from a database. I need to select a value from dropdown list and assign it to textbox by using Javascript.</p>
  
  <p>Code:  </p>
  
  <pre><code>var textboxId = document.getElementById("txtCountry");
  var dropdownListId =document.getElementById("ddlLocation"); 
  
  var e = document.getElementById("ddlLocation"); 
  var strUser = e.options[e.selectedIndex].value;
  
  document.getElementById(textboxId).value = strUser;    
  document.getElementById(textboxId).focus(); 
  </code></pre>
  
  <p>by doing this I am getting error. Any solutions?</p>