I am using WSPBuilder. I want to create the package that includes the MenuItemList and MenuWebpart. Requirement is create the feature for MenuItemList which holds the menu items. Webpart should fetch the menu items from the sharepoint list. and display as per CSS applied.

What I have done: I have created the WSPBuilder Project in VS2010. Under the Feature I have added the Blank Feature. Named as MenuItemsFeature. also i have added the visual webpart feature.\

Confusion: I am confused how to start coding for this scenario. I means, If both features are in same package, and second is dependent on first (Webpart is dependent on List) then how to set execution sequence will be done? While writing the Webpart code, How it predicts there is list, name with "MenuItemFeature" ? If I want to make this MenuItemList generic (scalable: to add columns runtime) then what i have to do ? there are so many confusion still in my mind... but initially i need to resolve these one. I read about WSPBuilder. but there is no such link for dependent feature available so far, as per my search.

Can somebody guide me proper sequence , how can i achieve this.

  • It sounds like you're mixing the use of WSPBuilder with the VS2010 SharePoint development tooling. This is a bad idea. Use one or the other, but not both, in the same solution. – James Love Jun 22 '11 at 9:58
  • no no..miss understanding i guess... I am using WSPBuilder plugins in Visual Studio 2010. I have created the wspbuilder project , and in feature Folder added new items (Features) as Blank Feature and Visual webpart. – Red Swan Jun 22 '11 at 10:08
  • Ah right, understood. – James Love Jun 22 '11 at 10:10

I strongly recommend you look at some tutorials for introductory web part development in SharePoint 2010, and also look at how to create List Instances from Features. Both are pretty standard tasks when it comes to development.

Here's a full tutorial on creating a web part in Visual Studio 2010.

List Instances are standard, out of the box Visual Studio 2010 Project Items which you can easily add to a solution - but only if you are using the standard SharePoint Development tooling and not mixing with WSPBuilder.

If you are limited to not using the Visual Studio 2010 SharePoint features, then here's a tutorial for creating a list instance by hand, which is how it's done in SharePoint 2007.

Also, have a look at Feature Activation Dependencies, if you're Web Part requires that the List Instance be created first.

|improve this answer|||||
  • Thanks James Love, It is really helpful for me. but best for using Visual Studio 2010 sharepoint tooling ,right? some how i am bound with requirements as "Use WSPBuilder in Visual Studio 2010" I have restrictions to use that. else i definitely prefer the VS tooling. Also, I need to resolve this scenario ASAP. but confuse confuse confuse... u know. need deep help buddy – Red Swan Jun 22 '11 at 10:13
  • Right, so if you look for tutorials for SharePoint 2007 (web parts, list instances and Features in general), most of the material you will come across will work in SharePoint 2010. – James Love Jun 22 '11 at 10:17
  • no worry... but if i could jut know how two feature can interact with each other under single wspproject solution. then it would fine to move a head. – Red Swan Jun 22 '11 at 10:24
  • Feature's don't really interact with each other. They are their own unit of functionality that deploys artefacts. In your scenario, one Feature will deploy a web part, the other will create a List Instance. The logic in your web part will use the SharePoint Object Model to retrieve data from the list. Your web part might have a property to store a String, which will be used as the Name of the List which stores your menu items. Here's a question on MSDN, on how to access a list: social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/… – James Love Jun 22 '11 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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