Webpart Titles not shown in WebPartZone…

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.

Webpart Titles not shown in WebPartZone…

8 thoughts on “Webpart Titles not shown in WebPartZone…

  1. 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

  2. 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.

  3. 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!

  4. Majid says:

    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”.

  5. Interesting. Yeah, I don’t quite get how that might relate, but it is pretty interesting to see. Thanks!

    Hard coding – tut tut.

  6. Chase says:

    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.

  7. William says:

    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

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.