views:

95

answers:

1

We're using ASP.NET webparts in our application and I want to prevent the user from adding the same webpart twice from the catalog if they already have an instance on the page.

I know that I can intercept the add by hooking up to the WebPartAdding event of the WebPartManager object and canceling the event, I just need to know how to peek at the current user's personalization settings to see if they're already using it.

Or, is there another route (i.e. looking at all visible webparts in use on the page)?

A: 

Ah, I now see that I can peek in the WebPart collection of the WebPartManager control to see which ones are currently active.

This gets me the information I needed so that I can cancel the add if it is already in use.

Don