<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web Parts and Personalization</title><link>http://forums.asp.net/145.aspx</link><description>Discussions of the new ASP.NET 2.0 portal framework.  &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=167&amp;c=30" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/2237749.aspx</link><pubDate>Mon, 17 Mar 2008 16:04:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2237749</guid><dc:creator>matthewwebster</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2237749.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=2237749</wfw:commentRss><description>&lt;p&gt;Thankyou for this!&amp;nbsp; I was wondering just exactly this thread&amp;#39;s original question :)&amp;nbsp;&amp;nbsp; Aren&amp;#39;t forums great!&lt;/p&gt;&lt;p&gt;I was wondering how many different ways people have performed filtering of controls to force only one instance of a web part?&lt;/p&gt;&lt;p&gt;The way I did it was to compare the class name of the control within the added web parts against the one being added...&lt;/p&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;protected void&lt;/span&gt; WebPartManager1_WebPartAdding(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, WebPartAddingEventArgs e)
{
    &lt;span class="cmt"&gt;// get element being added - used a base class to check each control can/not be added multiple times&lt;/span&gt;
    MyControl addElement = (MyControl)((GenericWebPart)e.WebPart).ChildControl;

    &lt;span class="cmt"&gt;// if the control is allowed multiple times (ie: not a &amp;#39;singletonpart&amp;#39;) exit check&lt;/span&gt;
    &lt;span class="kwd"&gt;if&lt;/span&gt; (!addElement.isSingletonPart)
        &lt;span class="kwd"&gt;return&lt;/span&gt;;

    &lt;span class="cmt"&gt;// get the new element&amp;#39;s control pathname&lt;/span&gt;
    &lt;span class="kwd"&gt;string&lt;/span&gt; path = addElement.GetType().Name;

    &lt;span class="cmt"&gt;// check pathname against each element currently in the document&lt;/span&gt;
    &lt;span class="kwd"&gt;foreach&lt;/span&gt; (GenericWebPart part &lt;span class="kwd"&gt;in&lt;/span&gt; WebPartManager1.WebParts)
    {
        &lt;span class="kwd"&gt;if&lt;/span&gt; (part.ChildControl.GetType().Name.Equals(path))
        {
            &lt;span class="cmt"&gt;// found that the web part control has already been added, tell user and bail out of loop&lt;/span&gt;
            singletonWebPartWarning.Visible = &lt;span class="kwd"&gt;true&lt;/span&gt;;
            e.Cancel = &lt;span class="kwd"&gt;true&lt;/span&gt;;
            &lt;span class="kwd"&gt;break&lt;/span&gt;;
        }
    }
}
&lt;/pre&gt;&amp;nbsp;&lt;br /&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1683423.aspx</link><pubDate>Thu, 26 Apr 2007 12:50:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1683423</guid><dc:creator>kuldeepsaini80</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1683423.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1683423</wfw:commentRss><description>&lt;p&gt;there is event of webpartmanager ( WebPartManager1_WebPartAdding) this event invokd before webpart adding to webpartmanager.&lt;/p&gt;&lt;p&gt;You
can&amp;nbsp; write your code in this event.to prevent adding duplicate
webpart by checking whetjer there is web part in webparzone or not&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1644353.aspx</link><pubDate>Fri, 30 Mar 2007 09:39:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1644353</guid><dc:creator>rmr.adduri</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1644353.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1644353</wfw:commentRss><description>&lt;p&gt;Thanks for your reply. can you please provide me the source code regarding this if your have.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Ram&lt;/p&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1644248.aspx</link><pubDate>Fri, 30 Mar 2007 08:13:23 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1644248</guid><dc:creator>mharder</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1644248.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1644248</wfw:commentRss><description>&lt;p&gt;If you want to load the WebParts dynamically, you should write a custom CatalogPart.&amp;nbsp; DeclarativeCatalogPart is only intended for the &lt;strong&gt;declarative&lt;/strong&gt; scenario.&lt;/p&gt;
&lt;p&gt;-Mike&lt;/p&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1640817.aspx</link><pubDate>Wed, 28 Mar 2007 12:05:21 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1640817</guid><dc:creator>rmr.adduri</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1640817.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1640817</wfw:commentRss><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;Can you please tell me how to load these web user controls dynamically to declarativewebpart catalog instead of registering under the declarativecatalogpart. i have a requirement like this. please help me. &lt;/p&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1590836.aspx</link><pubDate>Thu, 22 Feb 2007 22:10:56 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1590836</guid><dc:creator>RaphaelThiney</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1590836.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1590836</wfw:commentRss><description>How do you add a part as "closed?"</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1511170.aspx</link><pubDate>Thu, 28 Dec 2006 16:06:50 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1511170</guid><dc:creator>davidanderson</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1511170.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1511170</wfw:commentRss><description>Dumb question: How do you add a part as "closed?" All I see is a visibility property. I'd like to add several parts that are already closed when the page initially displays.</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1146833.aspx</link><pubDate>Tue, 20 Dec 2005 01:28:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1146833</guid><dc:creator>mharder</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1146833.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1146833</wfw:commentRss><description>&lt;p&gt;ChromeStyle is the style (background color, border, etc.)&amp;nbsp;applied to the chrome rendered around the part.&lt;/p&gt;
&lt;p&gt;ChromeType controls what part of the chrome you want rendered.&amp;nbsp; For example, say&amp;nbsp;you didn't want to render the title bar on the WebParts.&lt;/p&gt;
&lt;p&gt;-Mike&lt;/p&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1145113.aspx</link><pubDate>Sat, 17 Dec 2005 01:30:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1145113</guid><dc:creator>orphicfireball</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1145113.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1145113</wfw:commentRss><description>So many types of web parts, I didn't realize I was just using the wrong one.&amp;nbsp; Thanks, this really helped me a lot.&lt;br /&gt;&lt;br /&gt;Hey could you also tell me what ChromeType is for?&amp;nbsp; "TitleOnly", "BorderOnly", I don't see how these would ever be useful.&amp;nbsp; ChromeState's purpose I understand, but not this ChromeType and ChromeStyle.&lt;br /&gt;</description></item><item><title>Re: Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1144734.aspx</link><pubDate>Fri, 16 Dec 2005 19:23:43 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1144734</guid><dc:creator>mharder</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1144734.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1144734</wfw:commentRss><description>&lt;p&gt;The DeclarativeCatalogPart is specifically designed to allow adding multiple instances of a WebPart type.&amp;nbsp; Why do you want to disallow this scenario?&lt;/p&gt;
&lt;p&gt;At any rate, the PageCatalogPart sounds like it might do the trick for you.&amp;nbsp; The PageCatalogPart lists all the closed WebParts on&amp;nbsp;the page.&amp;nbsp; So instead of adding your WebParts to the DeclarativeCatalogPart, you would add them to the page instead, but as closed WebParts.&amp;nbsp; Then, they would appear in the PageCatalogPart, but could only be "added" to the page once.&lt;/p&gt;
&lt;p&gt;-Mike&lt;/p&gt;</description></item><item><title>Prevent adding the same web part twice from a catalog</title><link>http://forums.asp.net/thread/1141090.aspx</link><pubDate>Tue, 13 Dec 2005 21:34:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1141090</guid><dc:creator>orphicfireball</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1141090.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=145&amp;PostID=1141090</wfw:commentRss><description>I have a catalogzone with a declarativecatalogpart inside.&amp;nbsp; Right now if you select a web part from the catalog and add it, it stays on the list, and you can add it again.&amp;nbsp; How do I take a web part off the list after it has been added?&amp;nbsp; Is there not just an attribute to prevent someone from having multiple of the same web part at once?</description></item></channel></rss>