Sunday, February 7, 2010

Solution Generator web part toolbar issue

I often use Solution Generator and have found many workaround to fit this tool to my needs. Recently I found 2 strange behavior, when I reverse engineer a site definition which has some list view web parts on one of the pages.

1. These web parts had toolbar set to Standard toolbar, it was not respecting the Toolbar type selected.

2. I have added some extra columns to the views, not getting the match when deploying the generated solution.

When I took a closer look at the CAML which got generated for the Webpart it had the right Toolbar value and columns in ViewFields.

Actually issue was the BaseViewID attribute for the tag.

Setting BaseViewID to Zero solved the issue.

Other important thing to use Solution Generator:
1. Always create a brand new site from out of box templates to generate a site definition

2. For ListView web parts, don't switch the View from the drop even if it matches your requirement.Always edit the Current View > Edit this View option.