Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm building an interface that allows for users to customize the webpart zones on their page to a layout of their choosing.

It seems the best way to do this is to have all possible layouts present on the page, and only render the layout that the user chooses, therefore allowing them to personalize the layout they like. ( *Meaning dynamically created web parts that are rendered at Page_init, while possible would likely not be able to hold personal state for each user* )

The issue I'm running into, is that I want to read from a configurtion list at page_load, and dynamically remove elements. I need to do this, because the layouts reside in a Jquery powered interface that relies on element.count to handle a unique type of horizontal pagination.

So, for example:

//{content} = WebPartZones
<div id="container">
  <div class="Grid" class="Home">{content}</div>
  <div class="Grid" id="GridOne" runat="server">{content}</div> <small Zone>
  <div class="Grid" id="GridTwo" runat="server">{content}</div> <large Zone>
  <div class="Grid" id="GridThree" runat="server">{content}</div> <small Zone>
  <div class="Grid" id="GridFour" runat="server">{content}</div> <large Zone>
</div>

//Home screen, plus two more panels of large webpart zones
User.Configuration.Layout = "Enum.StyleOne";
Page.GridOne.delete();
Page.GridThree.delete();

Here's where the problem comes in. I can't have the container and following elements inside of a visual web part embedded in the page, because the zones will be added to the page after init, which is not allowed and throws an exception.

I cannot use an application page, because I want this content to exist on the home page of a subsite (this page is part of a Site Definition).

I am therefore in a pickle because I want to re-arrange the content server side, but it seems to be impossible. The only thing I can think of is to embed a web part in the top of the page that renders a javascript element like window.pagelayout = StyleOne, and then have JQuery remove the elements before the PlugIn fires and reads container.elements.count.

Is there a way to do this server side? I'm worried about flicker.

share|improve this question
    
If this is 2010 they have the "Text Layout" setting if you are using the Wiki style pages (this is the default for a team site). Edit Page -> Format Text Tab -> Text Layout –  SpartanDonut Jun 25 '12 at 20:06

1 Answer 1

up vote 1 down vote accepted

Hi achieved this 100% dynamic page by creating calling content of web parts in a handler and having a controller web part that return the results in Jquery.

This method is no good for objects to do with security but it allows you to have the page load much quicker visually than it might perhaps normally would as well.

You could go into programatically moving web parts in zones but this is for everyone, and I presume this is a per user thing?

If it is, then a controller web part that is per user that uses jquery to call a handler code that returns the html content would be the slickest way of doing it in my book.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.