0

I am working in a custom web part for a customer and part of what i need to accomplish is creating a view for a list that i am also creating. Everything is fine until the point i want to set TablularView for that view to false. I thought it as as simple as:

SPView view = new SPView(newList, xml);
newList.Views.Add(view.Title, view.ViewFields.ToStringCollection(), view.Query, view.RowLimit, view.Paged, true);
newList.Views[view.Title].SetViewXml(schema);
newList.Views[view.Title].TabularView = false;
newList.Views[view.Title].Update();

But after debugging this part of the code TabularView stays TRUE, any hints?

Thanks a lot.

0

Not sure if this is the best answer but I found a workaround for this. Hope this helps someone. If someone knows a better way to do it please post it:

SPView view = new SPView(newList, xml);
newList.Views.Add(view.Title, view.ViewFields.ToStringCollection(), view.Query, view.RowLimit, view.Paged, true);

SPView newView = newList.Views[view.Title];
newView.TabularView = false;
newView.Update();

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.