title: Populate a dropdownlist with objectdatasource
body: <p>I'm trying to populate a dropdownlist with an objectdatasource programatically. It's a user control, so in my  ascx I have this:</p>
  
  <pre><code>    &lt;asp:ObjectDataSource ID="odsFicheros" runat="server" 
                          OldValuesParameterFormatString="original_{0}" 
                          onselecting="odsFicheros_Selecting" SelectMethod="ejecutaconsultaFicheros" TypeName="DatosGW.ControlBuscador"&gt;
  
      &lt;/asp:ObjectDataSource&gt;
  
       &lt;asp:DropDownList ID="cmbFicheros" runat="server" CssClass="form-control" 
                           DataTextField="fichero" DataValueField="fichero" DataSourceID="odsFicheros" 
                          ondatabound="cmbFicheros_DataBound" AutoPostBack="True" 
                          onselectedindexchanged="cmbFicheros_SelectedIndexChanged"&gt;
        &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>On the code behind I do this:</p>
  
  <pre><code>  protected void Page_Load(object sender, EventArgs e)
     {
  
  
  
      odsFicheros.TypeName = "DatosGW.ControlBuscador";
      odsFicheros.SelectMethod = "ejecutaconsultaFicheros";
      Parameter consultas = new Parameter(consulta, TypeCode.String);
      odsFicheros.SelectParameters.Add(consultas);
      odsFicheros.DataBind();
  
      cmbFicheros.DataSource = odsFicheros;
  
      this.ejecutarConsulta();
  }
  </code></pre>
  
  <p>And finally on my ControlBuscador class I have the method which returns a datatable, but it doesn't work, why?. If you need more details, please let me know it.</p>