i created a list view web part and tried to change its view to custom view. in following code the view gets created but never comes as default. i have to go to list view web part and change it manually....
web.AllowUnsafeUpdates = true;
ListViewWebPart lvwp = new ListViewWebPart();
lvwp.ListName = list.ID.ToString("B").ToUpper();
SPView view = list.Views["customview"];
view.Query = query;
lvwp.ViewGuid = view.ID.ToString("B");
lvwp.Visible = true;
web.AllowUnsafeUpdates = false;
I even tried with SPLimitedWebPartManager as shown in some example....
View Complete Post