Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a site with a Task List, which has a custom Gantt view as the default view. The home page of the site, which is not a wiki page, has a List View Web Part for the Task List where the Gantt view is selected.

When exporting the site as a template and creating a new site from the template, the List View Web Part reverts to the "All Items" list view (although there is no way to verify that this view is actually selected - the Web Part Editor says "Current View"). All other LVWPs on the front page get the correct view.

Trying to fix this, I wrote a snippet of code to first change the view of the LVWP after creating the page (didn't work) and then delete and re-create the web part with the correct view selected:

webPartToAdd.ListName = doclib.ID.ToString("B").ToUpper();
webPartToAdd.ViewGuid = doclib.Views[ganttView_Name].ID.ToString("B").ToUpper();

This does select the right view (the columns in the list view web part matches those in the Gantt view) but the Gantt chart itself doesn't actually display. The list view is a standard view. In order to actually get the Gantt view, I need to manually enter the web part editor, select the Gantt view and refresh the page. So this is obviously a bug. Is there a workaround?

Related post by myself on MSDN in March

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.