Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS Nuglet: Adding a Content Part to the Home Page Sidebar

The CMS-lite-like (and darned-near life-like) Community Server Content Part is the easiest thing in the world to add to your Community Server pages.  This nuglet addresses specifically how to add inline editable content to your CS home page sidebar, and secondarily, how to duplicate the contents of a content part on a page.

Any content part is added with the following ASP.NET code.  The only things to remember here are to ensure that both the contentname and id are unique.

<CS:ContentPart runat = "Server" contentname="contentPartID" id = "ContentPart1" text="default text" />

We're going to add a "Yousa" content part to the home page sidebar, so we wrap it in the following HTML to match other sidebar elements.

<div class="CommonSidebarArea">
   <h4 class="CommonSidebarHeader">My Yousa Content Part</h4>
   <div class="CommonSidebarContent">
     <CS:ContentPart runat = "Server" contentname="yousaPart" id = "ContentPart1" text="Yousa!" />
   </div>
</div>

 

When logged in as site administrators we will have full inline editing capabilities of that content area.

And as my good friend The Wizard says, set it...and forget it!

The original question that inspired this nuglet asked how to duplicate that content part on another area of the page.  To do that you would have to add a mod to display the contents of the cs_content.Body field contents inside the HTML anchor tags in something like a literal ASP.NET control.  Displaying two content parts with the same name and javascript wrappers will result in an error.

Comments (3) | Post RSS RSS comment feed

Posted on 10/24/2006 10:58:08 AM by Dave Burke
Categories: Community Server
Tags: no tags for this post

Related posts

Comments (3) -

10/24/2006 4:11:38 PM Permalink

Dave!!  Thanks bunches, it works too, (I didn't doubt you) Smile  Anyway, I really appreciate it.

Gary

P.S.: I am noticing the "Enter Code Here: Required" thingy to enable me to post this..perhaps I can persuade you to tell us how to do that too on CS? Smile

Gary Hodges |

10/25/2006 7:31:19 AM Permalink

Hi, Gary!  Glad to hear it's working!

The Enter Code thingy is my CAPTCHA control which you'll find in my Files area.  It's the 4th time I re-created it for either .Text or CS, and I'd like to think I improved on it.  I know I improved on how to install it.  Let me know if you have problems with it.  Thanks for leaving a comment about the nuglet.

daveburke |

1/10/2007 7:36:36 PM Permalink

Thanks for the helpful tip.  One problem I see after adding the above code- my new content box is left aligned in the sidebar.  I've tried adding align="center" after

but that didn't help.  Is there a trick to get this box centered?   Thanks

Yuan |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke