Constraining the number of occurrence of web part inside a webpartmanager

O

Oriane

Hi there,

I'm coding a Web site with Web part, and I would like each web part to
appear at most once (if they appear they cannot appear twice or more) on the
site. Is this possible to configure the Web part control or the web part
manager for this ?

Sincerely

Oriane
 
S

Steven Cheng[MSFT]

Hi Oriane,

From your description, you're using ASP.NET 2.0 webpart service and wonder
how to restrict the number for webparts in your application, correct?

As for the webpartManager and webpart personalization service, they're
associated with a certain ASP.NET web page, that means each page will has
its own webpart status info(stored in provider specific database...).
Therefore, do you mean that you want to restrict teh webpart number of each
webpart equiped page?

Based on my research so far, there doesn't have any direct interfaces or
setting that can do this. One possible approach is using the events of the
WebpartManager class:

#WebPartManager Class
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.
webpartmanager.aspx

as you can find in the class, it contains many events that you can
subscribe, include the events when a new webpart control is about to add or
has been added into the page's web part collection.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
O

Oriane

Hi Steven,
Steven Cheng said:
Hi Oriane,

From your description, you're using ASP.NET 2.0 webpart service and wonder
how to restrict the number for webparts in your application, correct?
I would like my user to add each webpart only once in the asp.net page.
As for the webpartManager and webpart personalization service, they're
associated with a certain ASP.NET web page, that means each page will has
its own webpart status info(stored in provider specific database...).
Therefore, do you mean that you want to restrict teh webpart number of
each
webpart equiped page? yes


Based on my research so far, there doesn't have any direct interfaces or
setting that can do this. One possible approach is using the events of the
WebpartManager class:

#WebPartManager Class
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.
webpartmanager.aspx
I will have a look on this link...
as you can find in the class, it contains many events that you can
subscribe, include the events when a new webpart control is about to add
or
has been added into the page's web part collection.
Thank you for your answer.

Oriane
 
S

Steven Cheng[MSFT]

Thanks for your reply Oriane,

If you get some new results, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Oriane" <[email protected]>
Subject: Re: Constraining the number of occurrence of web part inside a webpartmanager
Date: Mon, 14 Jan 2008 13:45:06 +0100
Hi Steven,
"Steven Cheng[MSFT]" <[email protected]> a écrit dans le message
de news:[email protected]...
Hi Oriane,

From your description, you're using ASP.NET 2.0 webpart service and wonder
how to restrict the number for webparts in your application, correct?
I would like my user to add each webpart only once in the asp.net page.
As for the webpartManager and webpart personalization service, they're
associated with a certain ASP.NET web page, that means each page will has
its own webpart status info(stored in provider specific database...).
Therefore, do you mean that you want to restrict teh webpart number of
each
webpart equiped page? yes


Based on my research so far, there doesn't have any direct interfaces or
setting that can do this. One possible approach is using the events of the
WebpartManager class:

#WebPartManager Class
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.
webpartmanager.aspx
I will have a look on this link...
as you can find in the class, it contains many events that you can
subscribe, include the events when a new webpart control is about to add
or
has been added into the page's web part collection.
Thank you for your answer.

Oriane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top