Preface: I did not come up with this implementation, just dealing with it.

I have a web part zone that gets 3 content editor web parts loaded into it dynamically through the feature receiver. The content parts are created on the page, exported to XML, the XML exports are added to the VS project, and then deleted from the page to be added through the receiver to an aspx page with zones defined. An SPLimitedWebPartManager is used in the FeatureActivated event and calls AddWebPart() for each content part to be added (the XML files).

The problem is the order that they are displayed on the page. The sequence of adding them in the receiver is correct, and the only order property I can discern in the XML is PartOrder which are currently set to 1,2, and 10. They should display in that order but the second one is always last on the final page.

I've tried deleting/recreating the site collection and they still always appear in the wrong order.

Any idea on how to get them to be added to the page in the proper order?


2 Answers 2


Can you debug the feature receiver and look at the parameters being passed to AddWebPart()? Make sure the zoneId value is correct, e.g. "RightColumn" and that the zoneIndex looks right. Are you sure that PartOrder is the value passed in as zoneIndex? It is suspicious that the order is 1, 10, 2, since that is sorted alphabetically; maybe the code that reads the XML is sorting string values instead of converting to a number first.


You should try to use the ZoneIndex property (attribute) instead of the PartOrder. PartOrder is obsolete since WSS 3.0. PartOrder can lead to some confusion because the WebPart base class (System.Web.UI.WebControls.WebParts.WebPart) does not have this property. But that should not be the problem in your case because you are adding three web parts of the same type (is that correct?).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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