locked
WebPartZone border-properties not doing anything? RRS feed

  • Question

  •     
    Hey,

    I've been banging my head to the wall for quite some time trying to modify the WebPartZone and/or WebPart properties. I have custom master page and custom page layout where I'd like to have WebPartZone and have a border on each WebPart in it. I'm running MOSS 2007.

    I've tried to manually add tag to the right place:
    <WebPartPages:WebPartZone runat="server" ID="TopRightZone" Title="TopRightZone" BorderStyle="Solid" BorderColor="Black" BorderWidth="2px" QuickAdd-GroupNames="Default">
    </WebPartPages:WebPartZone>

    This makes the WebPartZone appear otherwise correctly but the border properties do not seem to do anything at all. In the source code the table has border="0" whatever I set the property to. Some other, such as BackColor work as should.

    I also tried to modify the information with Sharepoint Designer, it lets me set the values but they do not stick or appear.

    I also tried to modify this without my custom master page and with a brand new, empty page layout, but the result is the same... What am I missing?

    -Juha
    Friday, March 27, 2009 1:34 PM

Answers

  • Yea, spot on with the shadows remark, but there is a way to add specific styles to each web part in the zone - if you have the web part zone in a div tag you can do things like "#MyDivTag Table" and add a border to that to get the styles working, so the border will apply to all tables in the web part zone. Or build off the MS styles, so "#MyDivTag .wb-header" should apply a style to the header of the web parts in the zone.
    Brian Farnhill
    Microsoft Certified Application Developer
    blog.brianfarnhill.com
    Canberra SharePoint User Group
    • Marked as answer by srkks Tuesday, March 31, 2009 5:57 AM
    Monday, March 30, 2009 8:09 PM
  • Hi,

    This is by design, WebPartZone properties do not apply to a SharePoint WebPartZone. Hence they are not saved when their values are modified. These apply to ASP.Net WebPartZones and hence can be used through SPD on an ASP.Net WebPartZone. Any customization or formatting on a SharePoint WebPartZone may be done using CSS.

    As Brian said, you can put your WebPartZone in a div tag and then style the div tag.

    Hope it helps.

     


    Xue-Mei Chang
    • Marked as answer by srkks Tuesday, March 31, 2009 5:57 AM
    Tuesday, March 31, 2009 3:46 AM
    Moderator

All replies

  • Could you try wrapping the web part zone in a div and style it that way? I know it doesn't answer why those properties don't work (I will try to do the same thing when I get to work to see if its just you that can't get this right) but this is a definite way to get the result you are looking for.
    Brian Farnhill
    Microsoft Certified Application Developer
    blog.brianfarnhill.com
    Canberra SharePoint User Group
    Sunday, March 29, 2009 8:05 PM
  • Hey Brian, thanks for your answer.

    The thing is that I'd like to have border for each separate WebPart within the WebPartZone so that each WebPart would appear as their own "box". The (admin) users can add WebParts as they like, so I can't have a static containers for WebParts at that level and giving border or any styles for that matter for the WebPartZone is not the answer.

    I originally also wanted to have extra elements before and after each WebPart within the Zone (a small drop shadow effect for the elements), but was told that the code that produced the HTML around each WebPart is not accessible easily...
    Monday, March 30, 2009 6:26 AM
  • Yea, spot on with the shadows remark, but there is a way to add specific styles to each web part in the zone - if you have the web part zone in a div tag you can do things like "#MyDivTag Table" and add a border to that to get the styles working, so the border will apply to all tables in the web part zone. Or build off the MS styles, so "#MyDivTag .wb-header" should apply a style to the header of the web parts in the zone.
    Brian Farnhill
    Microsoft Certified Application Developer
    blog.brianfarnhill.com
    Canberra SharePoint User Group
    • Marked as answer by srkks Tuesday, March 31, 2009 5:57 AM
    Monday, March 30, 2009 8:09 PM
  • Hi,

    This is by design, WebPartZone properties do not apply to a SharePoint WebPartZone. Hence they are not saved when their values are modified. These apply to ASP.Net WebPartZones and hence can be used through SPD on an ASP.Net WebPartZone. Any customization or formatting on a SharePoint WebPartZone may be done using CSS.

    As Brian said, you can put your WebPartZone in a div tag and then style the div tag.

    Hope it helps.

     


    Xue-Mei Chang
    • Marked as answer by srkks Tuesday, March 31, 2009 5:57 AM
    Tuesday, March 31, 2009 3:46 AM
    Moderator
  • Ok, thanks for both of you for help!

    I'll go on an fiddle with the the CSS for the tables then, it'll just be somewhat "nasty" CSS since just about everything is in tables within tables (sigh) :)
    Tuesday, March 31, 2009 5:57 AM