title: How to get DataTextField of DropDownList in javascript?
body: <p>I am using a DropDownList as </p>
  
  <pre><code>&lt;asp:DropDownList 
    ID="ddlLocationName" 
    runat="server" 
    DataValueField="Guid" 
    DataTextField="LocationName" 
    AppendDataBoundItems="false" 
    AutoPostBack="false" 
    onchange="LocationChange()"
  &gt;&lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>and when I select item from dropdown the DataTextField should be displayed in the textfield. For that i am using following javascript: </p>
  
  <pre><code>function LocationChange()
  {  
    document.getElementById ("ctl00_mainContent_ctl02_txtEventLocation").value = document.getElementById ('ctl00_mainContent_ctl02_ddlLocationName')[document.getElementById ('ctl00_mainContent_ctl02_ddlLocationName').selectedIndex].value     
  }
  </code></pre>
  
  <p>It works fine when dropdown's DataValueField is not used. But how to do desired task when DataValueField property of dropdown is also used?</p>
  
  <p>Thanks in advance.</p>