Set the Title of a ListViewWebPart

Something that has bothered me repeatedly in the past is that ListViewWebParts didn’t seem to allow their titles to be set via CAML. The View element for a site (i.e. in the ONET.xml file) doesn’t have a title element, and the ‘Name’ and ‘DisplayName’ elements don’t set the web part’s title. Instead, the ListViewWebPart always seemed to pick up the name of the list it referred to. This was a problem if you had a page that showed two ListViewWebParts refering to the same list. E.g.:

<View List="Lists/Tasks" BaseViewID="7" WebPartZoneID="Left" WebPartOrder="5" />
<View List="Lists/Tasks" BaseViewID="9" WebPartZoneID="Left" WebPartOrder="6" />

would result in:

How can we set those titles to be different? Continue reading “Set the Title of a ListViewWebPart”

Set the Title of a ListViewWebPart