We have two ListViewWebPart webparts created dynamically (i.e programatically ) on the default.aspx page on two separate manual activations of the features. Two different lists are also assigned to them programatically. These lists have different buttons
on the document ribbon and different buttons are disabled for each list.
Following is how the webparts are created.
SPFile file = currentWeb.GetFile("Default.aspx");
SPLimitedWebPartManager mngr = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
list = file.ParentFolder.ParentWeb.Lists[ComplianceDocLib.DocumentLibName];
ListViewWebPart lv = new ListViewWebPart();
lv.TitleIconImageUrl = "_layouts/images/iQDocLib.png";
lv.ListName = list.ID.ToString("B").ToUpper();
lv.ViewGuid = list.Views["HomePage"].ID.ToString("B").ToUpper();
mngr.AddWebPart(lv, "Left", 0);
When the user clicks on the item check box on the list view webpart the ribbon that is shown
belongs to one of the list and this does not chang
View Complete Post