ToolBox WepParts Control ProxyWebPartManager

ProxyWebPartManager Web Server Control

in ASP.NET environment,This article describes you how to work with ProxyWebPartManager Web Control.The ProxyWebPartManager control can create static connections in a content page when a WebPartManager control has been declared in the content page's associated master page.

Moreover, The WebPartManager control is used by a page that manages all Web Parts controls on the page. When a Web Parts application uses master pages, it is common to place the WebPartManager control in the master page. When content pages are merged with the master page at run time, the single WebPartManager control can manage Web Parts controls on all the content pages.

<staticconnections> element can declare a static connection and that required the child element <asp:webpartconnection>. when you use master pages and put the WebPartManager control in the master page, you cannot create a <asp:webpartmanager> element in a content page; only one WebPartManager control is permitted. The solution is to use a ProxyWebPartManager control on the content page, which takes the place of the WebPartManager control.

The ProxyWebPartManager's connections are added to the StaticConnections collection of the WebPartManager control in the Runtime and treated like any other connection.

ProxyWebPartManager Vs WebManagerControl

  • The ProxyWebPartManager control is used only when you have created a WebPartManager control in a master page and you want to declare static connections in the content page.
  • The ProxyWebPartManager control therefore has more limited functionality than the WebPartManager control.
  • Although the ProxyWebPartManager control acts as a proxy to contain static connections for the WebPartManager control in content pages, it does not inherit from the WebPartManager control.

The following code snippets explains you the ProxyWebPartManager to declare static connections on content pages in an application that uses master pages

in .aspx.cs page,

  WebPartManager _manager;

  void Page_Init(object sender, EventArgs e)
  {
    Page.InitComplete += new EventHandler(InitComplete);
  }  

  void InitComplete(object sender, System.EventArgs e)
  {
    _manager = WebPartManager.GetCurrentWebPartManager(Page);

    String browseModeName = WebPartManager.BrowseDisplayMode.Name;
    
    foreach (WebPartDisplayMode mode in _manager.SupportedDisplayModes)
    {
      String modeName = mode.Name;      
      if (mode.IsEnabled(_manager))
      {
        ListItem item = new ListItem(modeName, modeName);
        DisplayModeDropdown.Items.Add(item);
      }
    }
    
    if (_manager.Personalization.CanEnterSharedScope)
    {
      Panel2.Visible = true;
      if (_manager.Personalization.Scope == PersonalizationScope.User)
        RadioButton1.Checked = true;
      else
        RadioButton2.Checked = true;
    }
    
  } 
  
  void DisplayModeDropdown_SelectedIndexChanged(object sender, EventArgs e)
  {
    String selectedMode = DisplayModeDropdown.SelectedValue;

    WebPartDisplayMode mode = _manager.SupportedDisplayModes[selectedMode];
    if (mode != null)
      _manager.DisplayMode = mode;
  }
  
  void Page_PreRender(object sender, EventArgs e)
  {
    ListItemCollection items = DisplayModeDropdown.Items;
    int selectedIndex = 
      items.IndexOf(items.FindByText(_manager.DisplayMode.Name));
    DisplayModeDropdown.SelectedIndex = selectedIndex;
  }
  
  protected void LinkButton1_Click(object sender, EventArgs e)
  {
    _manager.Personalization.ResetPersonalizationState();
  }
  
  protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
  {
    if (_manager.Personalization.Scope == PersonalizationScope.Shared)
      _manager.Personalization.ToggleScope();
  }
  
  protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
  {
    if (_manager.Personalization.CanEnterSharedScope && 
        _manager.Personalization.Scope == PersonalizationScope.User)
      _manager.Personalization.ToggleScope();
  }

        

in .aspx page,

<div>
  <asp:Panel ID="Panel1" runat="server" 
    Borderwidth="1" 
    Width="230" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
    <asp:Label ID="Label1" runat="server" 
      Text=" Display Mode" 
      Font-Bold="true"
      Font-Size="8"
      Width="120" />
    <asp:DropDownList ID="DisplayModeDropdown" runat="server"  
      AutoPostBack="true" 
      Width="120"
      OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged" />
    <asp:LinkButton ID="LinkButton1" runat="server"
      Text="Reset User State" 
      ToolTip="Reset the current user's personalization data for the page."
      Font-Size="8" 
      OnClick="LinkButton1_Click" />
    <asp:Panel ID="Panel2" runat="server" 
      GroupingText="Personalization Scope"
      Font-Bold="true"
      Font-Size="8" 
      Visible="false" >
      <asp:RadioButton ID="RadioButton1" runat="server" 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged" />
      <asp:RadioButton ID="RadioButton2" runat="server" 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        OnCheckedChanged="RadioButton2_CheckedChanged" />
    </asp:Panel>
  </asp:Panel>
</div>
                    
 
Related Links

Posted by: Admin
Posted on: 9/17/2009 at 5:12 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (26) | Post RSSRSS comment feed

Comments

Onlineatoz.net

Thursday, September 17, 2009 5:14 PM

trackback

ToolBox WepParts Control WebPartManager

ToolBox WepParts Control WebPartManager

ucvhost United States

Friday, February 05, 2010 1:05 PM

ucvhost

great stuff thanks for sharing

Rapidshare United States

Wednesday, April 28, 2010 3:18 AM

Rapidshare

I\'m happy I found this blog, I couldnt discover any info on this subject matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if possible feel free to let me know, i\'m always look for people to check out my site. Please stop by and leave a comment sometime!

granite sink0 Mexico

Wednesday, May 19, 2010 9:42 AM

granite sink0

AW,this was a really quality post.I am very happy to see your article.

17 laptop messenger bag United States

Thursday, May 20, 2010 4:01 AM

17 laptop messenger bag

It helped me with ocean of knowledge so I really believe you will do much better in the future I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer!

Edgar Iraq

Monday, May 24, 2010 6:57 PM

Edgar

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.Any way Ill be subscribing to your feed and I hope you post again soon

Svitlana.Net.Ua United States

Wednesday, June 16, 2010 4:55 AM

Svitlana.Net.Ua

I would like to thank you for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now.

vibram fivefingers People's Republic of China

Friday, June 18, 2010 3:41 AM

vibram fivefingers

I really like this type of Shoes too, can you help me look at which one has higher price point?
http://vibramshoesonline.com

няня United States

Friday, June 18, 2010 11:52 PM

няня

I would like to thank you for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now.
http://svitlana.net.ua/staff/category/3/ гувернантка, http://svitlana.net.ua/staff/category/5/ повар, http://svitlana.net.ua/staff/category/6/ садовник, http://svitlana.net.ua/staff/category/10/ репетитор, http://svitlana.net.ua/staff/category/4 домработница, http://svitlana.net.ua/staff/category/8/ семейная пара, http://svitlana.net.ua/pages/2/ работа няней.

Индивидуалки United States

Thursday, June 24, 2010 8:33 AM

Индивидуалки

Несколько раз, мужчины из нашей группы, все-таки ходили в город, что бы найти места, в которых работают проститутки Сочи и на пару часов предаться любовным утехам и играм, но, куда ж без этого, все понимали такую тягу и нормально относились к таким походам.

mbt shoes store People's Republic of China

Thursday, June 24, 2010 8:47 AM

mbt shoes store

"Hhe article's content rich variety which make us move for our mood after reading this article. surprise, here you will find what you want! Recently, I found some wedsites which commodity is colorful of <a href="www.mbt-outlet-store.com/...women-shoes.html"" rel="nofollow">www.mbt-outlet-store.com/...women-shoes.html" >MBT women Chapa GTX</a>  fashion. Such as  that worth you to see. Believe me these websites <a href="www.mbt-outlet-store.com/...women-shoes.html"" rel="nofollow">www.mbt-outlet-store.com/...women-shoes.html" >MBT Lami</a>  won’t let you down.<a href="  http://www.eeadie.com" >eeadie</a>
"

покер United States

Sunday, June 27, 2010 12:43 PM

покер

It\'s an intriguing approach. I ordinarily stumble upon ordinary thoughts on the theme but yours it\'s written in a pretty special way. Sure enough, I will revisit your website for additional information.

does hypnosis really work United States

Thursday, July 01, 2010 12:25 AM

does hypnosis really work

Hypnotherapists are educated to empower men and women to tap their individual inner resources to adjust their perceptions and responses to situations  for instance  to modify the physical sensation of discomfort to some sensation of coolness  In hypnotherapy  it may be the client who controls his or her very own head in purchase to offer the whole organism - the thoughts  the entire body and also the ineffable sense of self - a happier expertise of living  Concerning the charge of 1 particular person s brain by an additional  hypnotherapists know as minor about that as any person  and almost certainly a lot a smaller amount than do federal government officials

iphones 3gs cases United States

Thursday, July 01, 2010 7:12 AM

iphones 3gs cases

As of now the Pwnage Instrument two 0 only functions using a Mac and supports the subsequent gadgets and firmwares    apple iphone  1st Gen  with two 0  Activated  Unlocked   Jailbroken   with assist for 3rd occasion software    ipod device Contact with two 0  Activated   Jailbroken   with assistance for 3rd celebration uses    i phone  3G  with two 0  Activated  Jailbroken  withA    assist for 3rd bash programs  

Магазин сантехники United States

Monday, July 05, 2010 8:50 AM

Магазин сантехники

You made fantastic nice points here. I performed a search on the issue and discovered almost all peoples will agree with your blog.

musicians friend guitar United States

Monday, July 05, 2010 9:06 AM

musicians friend guitar

For what its really worth, the layout is undoubtedly incredible.  You already know tips on how to balance writing and images/videos.  Nonetheless, I cant get more than how small you really provide to light the following.  I consider that everyones stated the exact same point that youve mentioned around and above once more.  Dont you feel its time for some thing much more?

Индивидуалки Москвы United States

Thursday, July 08, 2010 5:03 PM

Индивидуалки Москвы

I really got a kick out of your article. I don\'t really have much to say in reply, I only wanted to comment to reply with wonderful operate. good luck in 2010.

Проститутки United States

Sunday, July 11, 2010 10:14 AM

Проститутки

You gave nice ideas here. I done a research on the issue and learnt most peoples will agree with your blog. Certainly, these practices are unfair; but they say that most of their rules are only to apply to people who overdraw.

Новинки сантехники United States

Monday, July 12, 2010 5:35 AM

Новинки сантехники

You have some honest ideas here. I done a research on the issue and discovered most peoples will agree with your blog.

ducati puma shoe United States

Tuesday, July 20, 2010 12:19 PM

ducati puma shoe

Interesting idea, good luck and keep up the good work

nfl jersey People's Republic of China

Friday, July 23, 2010 9:16 AM

nfl jersey

Thanks for the info!!

Rocket Piano Germany

Wednesday, July 28, 2010 2:27 PM

Rocket Piano

Truly, fantastic posting! Kudos for sharing. I do have a couple questions for you, so I'll look for your email and email them directly if that's okay.

HostGator Coupons Greece

Wednesday, July 28, 2010 2:35 PM

HostGator Coupons

I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!

Timberland Boots sale United States

Thursday, July 29, 2010 11:48 AM

Timberland Boots sale

Through reading more good articles to improve our quality of life. Your blog make me feel comfortable. At the sametime,http://www.timberlandshoesonline.com I will introduce you to know about a comfortable shoes that makes your life better! you can choice what you like!

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading