views:

12

answers:

0

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:

  1. Create a new Visual Web Part

  2. Add a new class library to the solution.

  3. Class code is as follows:

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace WebPartODS
{
  [System.ComponentModel.DataObject(true)]
  public class TestUser
  {
    [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select,false)]
    public List<int> TestMethod()
    {
      return new List<int>();
    }
  }
}
  1. Add the class library project as a reference in the Web Part project

  2. In the VisualWebPart ascx file, add a objectdatasource in the Source view:

<asp:ObjectDataSource ID="TestOD" runat="server"></asp:ObjectDataSource>

  1. Switch to Design view, bring up the "Configure data source" wizard. On the drop down, the class from the library project will not appear.

Is there a step that I am missing here, or is there an issue with trying to do it this way?

related questions