As others have said the correct approach is to programmatically achieve this rather than edit the content database which will make your installation unsupportable. I regularly use a console application to do this in a site collection made up of sites created from a site template.
Here is an example that changes the Title property of a ListViewWebPart. Updated to include code for recursive loop. I haven't tested this but it should work.
private static void ProcessSiteCollection(string url)
{
using (SPSite siteCollection = new SPSite(url))
{
SPWeb rootWeb = siteCollection.RootWeb;
ProcessWebs(rootWeb);
}
}
private static void ProcessWebs(SPWeb parentWeb)
{
foreach (SPWeb web in parentWeb.Webs)
{
try
{
UpdateWebPart(web); // Set web part properties
ProcessWebs(web); // Recursively loop through children
}
finally
{
web.Dispose();
}
}
}
private static void UpdateWebPart(SPWeb web)
{
using (SPLimitedWebPartManager webPartManager =
web.GetLimitedWebPartManager("default.aspx", PersonalizationScope.Shared))
{
try
{
foreach (WebPart webPart in webPartManager.WebParts)
{
if (webPart.Title == "My Web Part")
{
ListViewWebPart listViewWebPart = (ListViewWebPart)webPart;
listViewWebPart.Title = "Updated Web Part";
webPartManager.SaveChanges(listViewWebPart);
web.Update();
break;
}
}
}
finally
{
webPartManager.Web.Dispose();
}
}
}
When you add a web part to the standard list views, the page is no longer classified as a list view page, but instead it is classed as an application page.
This means you lose the ribbon menu, as well as the view selector in the breadcrumb.
UPDATE
You can see the code that hides the view selector in:
Microsoft.SharePoint.WebControls.ListTitleViewSelectorMenu.SingleWebPartPresentOnPage
But I can't seem to find the code that hides the ribbon.
UPDATE
Okay i think this will work, add a content editor web part with this code:
<script>
setTimeout(function() {
var elem = document.getElementById("MSOZoneCell_WebPartWPQ2");
if(elem != null) {
var dummyevent = new Array();
dummyevent["target"] = elem;
dummyevent["srcElement"] = elem;
WpClick(dummyevent);
}
}, 2000);
</script>
Replace the MSOZoneCell_WebPartWPQ2 id with the web part zone cell of the list view web part.
Best Answer
You need to create Custom Web Part Editor with DropDownList
Creating a Custom Web Part Editor in SharePoint 2010
and using SharePoint Object Model to fill this dropdownlist like this (not tested):