title: ObjectDataSource stored procedure parameter is from a method?
body: <p>I'm trying to set an ObjectDataSource up with a GridView in an asp.net web-forms application.  The select command that I plan on using for the ObjectDataSource returns a DataTable by querying the database with a stored procedure, like so: </p>
  
  <pre class="lang-cs prettyprint-override"><code>public DataTable GetProductsById(string ids = null)
          {
  
              DataTable productDataTable = new DataTable();
  
              // Stored procedure (sqldb server) is executed here
              SqlCommand cmd = new SqlCommand("GetProductByIdsRML_CLR", conn);
              cmd.CommandType = CommandType.StoredProcedure;
              SqlParameter myParam = new SqlParameter("@ids", SqlDbType.NVarChar);
              myParam.Value = (ids);
              cmd.Parameters.Add(myParam);
              SqlDataAdapter dataAdapter = new SqlDataAdapter();
              dataAdapter.SelectCommand = cmd;
  
              dataAdapter.Fill(productDataTable);
  
              return productDataTable;
          }
  </code></pre>
  
  <p>The method takes as an argument a string which is a comma delimited list of Product IDs, this parameter is passed to the stored procedure which then executes the query.  I'm having trouble setting this up correctly, though, because this input <code>ids</code> is passed to this method via another method in the code.  Here lies the problem, because when trying to set up the ObjectDataSource, it asks where the parameter for the stored procedure should come from, but "another method" isn't an option.  Here's what I'm talking about:
  <img src="https://i.stack.imgur.com/FHaTm.png" alt="Choosing parameters for objectdatasource"></p>
  
  <p>None of those options seem to encapsulate "another method in this project".  If anyone knows what to do in this situation, that would be great.  Also, if it's not a good idea to return a DataTable from the stored procedure, that's fine too I can change that fairly easily, but the question still stands.  Thank you!  I feel like there is a very simple solution to this...</p>