Monday, 23 August 2010

Add ListView Web Part to Site Template

My challange was to add a ListView Web Part in my Site Template. The problem was, that the ListView Web Part is not a "normal" Web Part, but a view of the list i want to show.

This means, that you can't add it in the AllUsersWebPart section as you would normally do. Instead you can add it just after that section.


The code looks like this:

1. First I have added a list in the configuration section.



2. Then I reference a module in the module section.



3. At last, I add the view to the module, just like this.



BaseViewID is the index of the view in the list/library.

I hope you can use this example, and it will save you som time!

No comments: