change the 'current view' of a listviewwebpart

i am adding a webpart to my webpartpage like this:

ListViewWebPart lvwp = new ListViewWebPart();
lvwp.ZoneID = "RightColumn";
lvwp.PartOrder = 9; // low
lvwp.ListName = list.ID.ToString("B").ToUpper();
lvwp.ViewGuid = list.Views["FilesTemplateView"].ID.ToString("B").ToUpper();
lvwp.Description = "Topic Files";
lvwp.Title = "Files";
coll.Add(lvwp);

this will always put my webpart on the page with the 'current view' and not with the intended custom view.

anyone that can get me on the right track to do this



Answer this question

change the 'current view' of a listviewwebpart

  • change the 'current view' of a listviewwebpart