I have a project that will have a few components: Lists, WebParts, WebPart Pages and an Application Page. I know how to create and deploy all of the above using Visual Studio 2010 to a SharePoint Server 2010 site, except the WebPart Page.

What I'd like to know is how to create a custom WebPart Page and add other custom WebParts to that WebPage Page all using Visual Studio 2010 and C#, XML/XAML, etc.

I already know how to create a WebPart Page using the SharePoint Web interface and in SharePoint Designer then adding WebParts to it in there, but not in Visual Studio.

There is a reason for this apparent madness. Normally, when adding WebParts to SharePoint, I usually have to manually create a WebPart Page (in SPD or SP web interface), then add the WebParts to it. Instead, I'd like to be able to upload a single or maybe two or so WSP files that have all the components, including the WebPart Page with its WebParts added to it. When the feature is activated, the WebPage Page shows up with all its WebParts.

I have seen this done before. It was only a tiny part of a training course I did a few months ago. In an exercise we had to deploy a WSP solution to SharePoint, and everything showed up the similarly to have I attempted to describe it above. Unfortunately, I didn't get a chance to copy the WSP file to see how all this magic it was done.

Thank you in advance for your help and advice!

1 Answer 1


You could try adding WebPart-Zones to a page and later add your WebParts to those WebPart-Zones programmatically.. See here. You could run this code in a feature receiver, for example.

The CKS Development Kit for SharePoint is a VisualStudio extension that might help you a little. It comes with some templates for pages ("Basic Site Page" iirc) that already contain WebPart zones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.