title: How to pass a URL parameter to a ObjectDataSource SelectMethod?
body: <p>I have a small example application with articles and comments.
  Users can view a specific Article by passing the article ID value in URL:</p>
  
  <pre><code>http://localhost:56079/viewArticle.aspx?id=123456
  </code></pre>
  
  <p>I want the Article id to be used to find corresponding comments and populate a gridview with them in the same form.</p>
  
  <p>viewArticle.aspx:</p>
  
  <pre><code>&lt;dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" Width="100%" DataSourceID="ObjectDataSource1"&gt;
                  &lt;Columns&gt;
                      &lt;dx:GridViewDataTextColumn  FieldName="field1"   Caption="Field #1"      VisibleIndex="0" /&gt;
                      &lt;dx:GridViewDataTextColumn  FieldName="field2"   Caption="Field #2" VisibleIndex="1" /&gt;
                  &lt;/Columns&gt;
              &lt;/dx:ASPxGridView&gt;
              &lt;asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
                  SelectMethod="searchComments"
                  TypeName="App.CommentManager"&gt;
                  &lt;SelectParameters&gt;
                  &lt;/SelectParameters&gt;
              &lt;/asp:ObjectDataSource&gt;
  </code></pre>
  
  <p>If <strong>id</strong> is "hard-coded" in the searchComments method, gridview is populated with correct entries.</p>
  
  <p>My only problem is passing the article <strong>id</strong> to searchComments method.</p>
  
  <ul>
  <li><p>I was thinking about a &lt;%# %>" style databinding approach, but it would be extremely dirty, and it still doesn't work.</p>
  
  <pre><code>SelectMethod="searchComments(&lt;%# Request.QueryString["id"] %&gt;)"
  </code></pre></li>
  <li><p>Another approach I tried was setting the selectmethod in codebehind like this:</p>
  
  <pre><code>ObjectDataSource1.SelectMethod = "searchComments('123456')";
  </code></pre>
  
  <p>That results in error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'searchComments('123456')' that has no parameters.</p></li>
  </ul>