Curious problem this – I had a web part zone where all web parts being put in it would be displayed without their titles. Didn’t matter if you manually went and turned on the chrome to show a title – that setting never saved, and the web parts didn’t ever have a title.
After tracking through all the page’s code, I found that when I set the WebPartZone’s ID to be ‘Main’ then my web parts ceased functioning correctly; their titles disappeared. If I set the ID back to ‘Left’, then all was fine.
I don’t know why this happens, but certainly using a different ID for my zone fixes it. If anyone knows why this actually happens, please let me know.
Hi Andy,
Sort of related question, but I’m sorry it doesn’t answer your post. If I come up with something to your question though, i’ll definitely post here.
Wondering if you or anyone here knew whether or not it was possible to move a web part within one web part zone only (i.e. Right zone can allow movement of web parts within that zone, but not to other zones; so of course in this scenario you must be assuming you’re having 2 or more web part zones)
I can think of ways in Designer to try this, but possibly this is a backend code customization; so I’m trying to think of best practice. This seems to undercut the .NET/SharePoint underlying premise of how web part zones and web parts work; but wanted to check.
Any ideas are greatly appreciated!
thanks,
t
Two possible properties that you might find useful:
AllowLayoutChange – http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartzonebase.allowlayoutchange.aspx
DragDropEnabled – http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webpartzonebase.dragdropenabled.aspx
You should be able to set these in the attributes on a web part zone (like title and so on), though I’ve never tried. Looks like they’ll do what you want.
Oh, and I did figure out what the problem was in the end – I already had an ASP.NET control called ‘Main’ on the page… I’d have expected a bigger error in that case, but there you go!
Possibly related. The Microsoft.SharePoint.WebPartPages.ListViewWebPart, which is used to display lists, has the following method and code when viewed using .NET Reflector:
this._amOnListViewPage = new bool?((base.WebPartZone != null) && (base.WebPartZone.ID == “Main”));
There seems to be specific and hard coded logic in Microsoft’s code when it comes to this web part appearing in a zone with the ID “Main”.
Interesting. Yeah, I don’t quite get how that might relate, but it is pretty interesting to see. Thanks!
Hard coding – tut tut.
Just wanted to add that this helped me solve a SP problem that’s been stumping me for a week (when I nuked one column of a two-column layout and renamed ‘Left’ to ‘Main’ because, well, semantics). Thanks much.
I was working on this forever. I solved it by opeing the site in Sharepoint Desginer. I then did a search for the word “Main” I then changed that word to “Let” and it worked perfectly. Unlike others though I can not find a webpart named “Main” Already though. In the end I am not sure what happens butthe solution does make sense. Thanks
The answer was right there in the article posted the comments above by Andy:
http://underthehood.ironworks.com/2012/10/changing-the-chrome-type-for-web-parts-in-sharepoint-2010.html
In the code-behind page in the sharepoint designer for the tag below:
Add the tag PartChromeType=”None” if it’s missing.
Or change the tag from PartChromeType=”None” to PartChromeType=”TitleAndBorder”
Thanks!