I'm interested in building a custom web part for SP2010 that's editable by the page editor via the web part menu's "Edit Web Part" option; specifically, I'd like to start with this: http://blogs.msdn.com/b/ramg/archive/2009/04/21/implementing-a-simple-cross-site-collection-list-view-webpart.aspx
I'm not sure what type of project to choose in Visual Studio 2010 for that web part. I chose a Visual Web Part project, and it created some files. Where would the code from that example go? Here's the code Visual Studio auto generated in the VisualWebPart1.cs:
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace CrossSiteListView.VisualWebPart1
{
[ToolboxItemAttribute(false)]
public class VisualWebPart1 : WebPart
{
// Visual Studio might automatically update this path when you change the Visual Web Part project item.
private const string _ascxPath = @"~/_CONTROLTEMPLATES/CrossSiteListView/VisualWebPart1/VisualWebPart1UserControl.ascx";
protected override void CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
}
}
}
Should I replace the above code with the code from that page? Your guidance on this will be much appreciated. Thanks :)