set selected value for a dropdownlist populated by a webservice
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4900051/set-selectedvalue-for-a-dropdownlist-populated-by-web-service">Set selectedvalue for a dropdownlist populated by web service</a>  </p>
</blockquote>



<p>I have a dropdownlist that is populated by a webservice using the ajax cascading dropdown. I have not been able to set  the selected value using javascript.  It appears that the values do not exist when the javascript runs.  I placed the javascript at the bottom of the aspx page.  Any ideas.  Here is all of the code and the javascript I have tried.</p>

<pre><code>&lt;asp:DropDownList ID="ddlBusinessArea" runat="server"&gt;&lt;/asp:DropDownList&gt;
&lt;cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="ddlBusinessArea" 
    Category="BusinessArea" ServiceMethod="GetBusinessArea" ServicePath="DropDownFilter.asmx" 
    LoadingText="Please Wait....."&gt;
&lt;/cc1:CascadingDropDown&gt;

&lt;WebMethod()&gt; _
Public Function GetBusinessArea() As CascadingDropDownNameValue()
    Dim values As New List(Of CascadingDropDownNameValue)()
    Dim objData As clsDataAccess = New clsDataAccess()
    Dim ds As DataSet = New DataSet
    Dim SQL = "select Description from tblvalidation where MyType = 'Business Area' order by description"
    ds = objData.SQLExecuteDataset(SQL)

    For Each dr As DataRow In ds.Tables(0).Rows
         values.Add(New CascadingDropDownNameValue(dr("Description"), dr("Description")))
    Next
    Return values.ToArray
End Function

&lt;script type="text/javascript"&gt;

   var e = document.getElementById("&lt;%=ddlBusinessArea.ClientID%&gt;"); 
   e.options[e.selectedIndex].value = "12345"

  document.getElementById("&lt;%=ddlBusinessArea.ClientID%&gt;").value = "12345"
  document.getElementById("ctl00_ContentPlaceHolder2_ddlBusinessArea").value = "12345"
&lt;/script&gt;
</code></pre>
