title: Does Visual Web Part support ObjectDataSource in designer?
body: <p>I'm trying to upgrade some Sharepoint 2007 webparts to SP2010 using the web part projects built into Visual Studio 2010. Namely, I'm using Visual Web Part to migrate our existing controls, which make extensive use of ObjectDataSource. However, when adding an ODS to the control in the Visual Web Part project, it will not pick up objects in referenced class library projects. I was able to duplicate the problem from a clean setup as follows:</p>
  
  <ol>
  <li><p>Create a new Visual Web Part</p></li>
  <li><p>Add a new class library to the solution.</p></li>
  <li><p>Class code is as follows:</p></li>
  </ol>
  
  <p>using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;</p>
  
  <pre><code>namespace WebPartODS
  {
    [System.ComponentModel.DataObject(true)]
    public class TestUser
    {
      [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select,false)]
      public List&lt;int&gt; TestMethod()
      {
        return new List&lt;int&gt;();
      }
    }
  }
  </code></pre>
  
  <ol start="4">
  <li><p>Add the class library project as a reference in the Web Part project</p></li>
  <li><p>In the VisualWebPart ascx file, add a objectdatasource in the Source view:</p></li>
  </ol>
  
  <p><code>&lt;asp:ObjectDataSource ID="TestOD" runat="server"&gt;&lt;/asp:ObjectDataSour</code>ce></p>
  
  <ol start="6">
  <li>Switch to Design view, bring up the "Configure data source" wizard. On the drop down, the class from the library project will not appear.</li>
  </ol>
  
  <p>Is there a step that I am missing here, or is there an issue with trying to do it this way?</p>