ToolBox WepParts Control ImportCatalogPart

ImportCatalogPart Web Server Control

in ASP.NET environment,This article describes you how to work with ImportCatalogPart Web Control.The goal of the ImportCatalogPart Web server control is to imports a description file for a WebPart control or any other server control.

By using ImportCatalogPart control,an user can add a control at the runtime into the web page. The description file enables users to share settings for WebPart controls.It is an XML file that that contains name/value pairs which describes the state of the control.After imports a description file, the WebPart control referenced in the file appears within the ImportCatalogPart control and a user can add the control to the page.

ImportCatalogPart control using with Web Parts controls

It can be compiled into an assembly or it can be a .ascx file for these purposes . In either case, the control must be referenced in an imported description file that exist on the Web server containing the hosting page.The ImportCatalogPart control can only at visible stage When a user switches the page to catalog display mode.

For exporting a Description file for a control, which meets the following,

  • The control has properties marked with the Personalizable attribute.
  • The Web.config file has the enableExport attribute value set to true in the element.
  • You have set the value of the ExportMode property on the control to a value other than the default value of None, which prohibits export.
Setting an ImportCatalogPart Web Server Control

For displaying an ImportCatalogPart Web server control run time , It requires a Web Parts page is in edit mode, and when the user has selected an associated WebPart control for editing.

the following code snippets demonstrates how to work with the ImportCatalogPart Control

in .aspx.cs page,

protected void Button1_Click(object sender, EventArgs e)
  {
    wp1.DisplayMode = WebPartManager.BrowseDisplayMode;
  }

  protected void Button2_Click(object sender, EventArgs e)
  {
    wp1.DisplayMode = WebPartManager.CatalogDisplayMode;
  }

  protected void Page_Load(object sender, EventArgs e)
  {
    Label1.Text = "Scope is: "
      + wp1.Personalization.Scope.ToString();
  }

        

in .aspx page,

<html  >
<head id="head1" runat="server">
    <title>Example</title>
</head>
<body>
    <form id="form2" runat="server">
    <div>
      <asp:WebPartManager ID="wp1" runat="server">
        <Personalization InitialScope="Shared" Enabled="True" />
      </asp:WebPartManager>

      <asp:WebPartZone ID="WebPartZone1" runat="server" 
        EmptyZoneText="No parts to show.">
        <ZoneTemplate>
        </ZoneTemplate>
        <CloseVerb Text="Close This Part" />
        <MinimizeVerb Text="Minimize This Part" />
        <EditVerb Text="Edit This Part" />
      </asp:WebPartZone>

      <asp:CatalogZone ID="CatalogZone1" runat="server" >
        <ZoneTemplate>
          <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
          <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
            runat="server">
            <WebPartsTemplate>
              <asp:Calendar id="Calendar1" runat="server" /> 
              <asp:CreateUserWizard ID="CreateUserWizard1" 
                runat="server" />
            </WebPartsTemplate>
          </asp:DeclarativeCatalogPart>
          <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server"/>
        </ZoneTemplate>
      </asp:CatalogZone>

      <hr />
      <asp:Button ID="Button1" runat="server" 
        Text="Browse Mode" OnClick="Button1_Click" />
      <asp:Button ID="Button2" runat="server" 
        Text="Catalog Mode" OnClick="Button2_Click" /><br />
      <asp:Label ID="Label1" runat="server" Text="" />
    </div>
    </form>
</body>
</html>                    
                    
 
Related Links

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

Comments

Onlineatoz.net

Thursday, September 17, 2009 5:17 PM

trackback

ToolBox WepParts Control WebPartZone

ToolBox WepParts Control WebPartZone

nike shox shop People's Republic of China

Monday, July 19, 2010 10:47 AM

nike shox shop

gth aertgaerh shy

nike shox store People's Republic of China

Monday, July 19, 2010 10:48 AM

nike shox store

RGAER RGAERG AERG  SHY

sacs à main pas cher Ukraine

Tuesday, July 20, 2010 10:45 AM

sacs à main pas cher

shy

puma trainers online People's Republic of China

Tuesday, July 20, 2010 12:17 PM

puma trainers online

This post was very well written, and it also contains many useful facts. I enjoyed your distinguished way of writing the post. You have made it very easy for me to understand. Gently use a swab to clean the upper ridges of the ear where wax will build up, and also behind the ear.

get rid of bad breath naturally United States

Wednesday, July 21, 2010 7:01 PM

get rid of bad breath naturally

When you are definitely severe about obtaining some thing to stop poor breath of air  you primary must know the result in from the trouble  Regrettably  the will cause of lousy breath of air are varied and you will discover times when halitosis doesn't even originate inside the oral cavity  Just a number of with the several poor air leads to to look at are

nfl jersey People's Republic of China

Friday, July 23, 2010 9:20 AM

nfl jersey

Thanks for the info!!

Timberland Boots sale United States

Thursday, July 29, 2010 11:53 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!

Auto Insurance Quotes United States

Friday, July 30, 2010 7:29 AM

Auto Insurance Quotes

If I could say one thing about this blog it would be design!  I mean, I was so distracted by the clashing colours that it was pointless to try to read the blog.  What are trying to do here exactly?  No one can read this is if it looks like a kid smashed a box of Crayola on your page!  Please do something about this.

Auto Insurance Quote United States

Friday, July 30, 2010 7:30 AM

Auto Insurance Quote

I cannot WAIT to read more of this.  I mean, you just know so much about this.  So much of it Ive never even thought of.  You sure did put a new twist on something that Ive heard so much about.  I dont believe Ive actually read anything that does this subject as good justice as you just did.

Buy Viagra United States

Friday, July 30, 2010 8:49 AM

Buy Viagra

Can I make a suggestion?  I think youve got something good here.  But what if you added a couple links to a page that backs up what youre saying?  Or maybe you could give us something to look at, something that would connect what youre saying to something tangible?  Just a suggestion.

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading