title: get selectedvalue of dropdownlist items added from javascript
body: <p>Hi I have added some items to <code>asp:DropDownList</code> from javascript. Like this</p>
  
  <pre><code> if (document.getElementById("&lt;%=gdview.ClientID %&gt;")!=null)
      {
      var rows = document.getElementById("&lt;%=gdview.ClientID %&gt;").getElementsByTagName('tr');
      var cells = rows[1].getElementsByTagName('td');
    //alert(cells)
      i = 2;
      while (i &lt; cells.length)
      {
          document.getElementById("&lt;%=ddl_noofCols.ClientID %&gt;").options[i] = new Option(i + 1, i);
          i++;
             }
      document.getElementById("&lt;%=ddl_noofCols.ClientID %&gt;").options[2].selected =true;
      alert(document.getElementById("&lt;%=ddl_noofCols.ClientID %&gt;").options[2].text);
      }
  </code></pre>
  
  <p>here gdview is gridview. no of columns of gridview are added to dropdownlist 
  default is <code>options[2]</code> is selected. I cannot the get selecteditem/selectedvalue using <code>ddl_noofCols.SelectedValue</code> which returns null. </p>
  
  <p>How can I get the selectedvalue.</p>
  
  <p>Thanks in advance.</p>