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

Is there any way to restrict a web part to a certain zone? I know I can restrict it by using the AllowZoneChange flag, but is it possible to make sure the web part can only be added to certain zones? I have some web parts which are only viable in a wide column (zones), so I want to make sure that no one tries to add the web parts to narrow columns (zones). Is there any way of accomplishing this?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

If you stick in a Quick Add Group with the same name as your "wide" one, it'll show up at the top of the list by default when someone tries to add a web part in that zone.

However, it will show up as normal further odwn the list when someone tries to add to another zone.

However, I don't think it's actually possible to do this at all - the only method I can think of, off the top of my head is to (somehow, maybe through modifyin the page layout directly) add some code to an event handler for SPWebPartManager.WebPartAdded to check the webpart and the zone, and to remove it if it was added in the wrong zone.

However, I've never tried to do this, nor know if it would work - feel free to give it a try though. Blog about it if you do get it to work!

Have a look at this for info on the event itself.

http://msdn.microsoft.com/EN-US/library/ms157584

share|improve this answer

I agree with James, I don't think it can be done easily. You can grant it the ability to change or not to change. Once a user places it on a page, they'll know quickly where to put it, to me it seems to be more work than is needed.

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.