Category Archives: DeclarativeCatalogPart

[RESOLVED] how to change orientation of webparts from vertical to horizontal in catelog zone

dear experts,


by default  closed webparts are listed in catelog zone vertically

for example,

[checkbox]  [webpart 1]

[checkbox]  [webpart 2]

[checkbox]  [webpart 3]


any one guide me which property is used to list them horizontally?

i want them like

[checkbox]  [webpart 1]   [checkbox]  [webpart 2]    [checkbox]  [webpart 3]


any help would be appreciated.


Hi,

You can use

 LayoutOrientation="Horizontal"

Regards
Shabir
<asp:CatalogZone ID="CatalogZone1" runat="server" BackColor="#F7F6F3" BorderColor="#CCCCCC"
                    BorderWidth="1px" Font-Names="Verdana" Padding="6" LayoutOrientation="Horizontal" >
                    <ZoneTemplate>
                    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />


                     <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server"  Title="Web Parts"  LayoutOrientation="Horizontal">
                        <WebPartsTemplate>
                           

                        </WebPartsTemplate>
                   </asp:DeclarativeCatalogPart>




                    </ZoneTemplate>
                    <PartLinkStyle Font-Size="0.8em" />
                    <PartTitleStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.8em" ForeColor="White" />
                    <EditUIStyle Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" />
                    <PartStyle BorderColor="#F7F6F3" BorderWidth="5px" />
                    <HeaderVerbStyle Font-Bold="False" Font-Size="0.8em" Font-Underline="False" ForeColor="#333333" />
                    <PartChromeStyle BorderColor="#E2DED6" BorderStyle="Solid" BorderWidth="1px" />
                    <EmptyZoneTextStyle Font-Size="0.8em" ForeColor="#333333" />
                    <SelectedPartLinkStyle Font-Size="0.8em" />
                    <VerbStyle Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" />
                    <LabelStyle Font-Size="0.8em" ForeColor="#333333" />
                    <FooterStyle BackColor="#E2DED6" HorizontalAlign="Right" />
                    <HeaderStyle BackColor="#E2DED6" Font-Bold="True" Font-Size="0.8em" ForeColor="#333333" />
                    <InstructionTextStyle Font-Size="0.8em" ForeColor="#333333" />
                </asp:CatalogZone>





Hi,

You can try to set the PartStyle:

<PartStyle
            GridLines="Horizontal"
            HorizontalAlign="Center"
/>

 

Hope this can help you.

[RESOLVED] how to add multiple controls to Declarative Catalog Part by default

dear experts ,

i want to add control 1, control 2 etc.. by default in Declarative Catalog Part

and using following code


DeclarativeCatalogPart dp = (DeclarativeCatalogPart)CatalogZone1.FindControl("DeclarativeCatalogPart1");
      if (!DeclarativeCatalogPart1.HasControls())
      {
     

      Control x = LoadControl("UserControls/Provider.ascx");
      x.ID = "Provider.ascx";
     

      DeclarativeCatalogPart1.Controls.Add(x);
      x = LoadControl("UserControls/Consumer.ascx");
      x.ID = "Consumer.ascx";
     

      DeclarativeCatalogPart1.Controls.Add(x);
      



      }



but it only displays last item in it

any one guide me what mistake am i doing or what is the solution to my problem?

actually i want to give default 4-5 webparts options so that user could add it to page

any help would be appreciated.

Hi,

I think the problem is this:

Control Class is a reference type in C#, so if you want to create multiple instance of usercontrol, you need to use "new" use new to invoke the new default constructor.

Like:

DeclarativeCatalogPart dp = (DeclarativeCatalogPart)CatalogZone1.FindControl("DeclarativeCatalogPart1");
      if (!DeclarativeCatalogPart1.HasControls())
      {
     
      Control x = LoadControl("UserControls/Provider.ascx");
      x.ID = "Provider.ascx";
      DeclarativeCatalogPart1.Controls.Add(x);

      x = new Control();  //create a new instance
      x = LoadControl("UserControls/Consumer.ascx");
      x.ID = "Consumer.ascx";
     
      DeclarativeCatalogPart1.Controls.Add(x);
      
 
      }

More information about the value types and reference types you can check:

http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx

http://www.albahari.com/valuevsreftypes.aspx

Hope this can help you.

Where in your code is this being called?  Why do you declare a DeclarativeCatalogPart dp and then never use it?  I can add a user control to DeclarativeCatalogPart1 but it always just gets dropped and replaced but whatever controls are statically declared in the aspx file.

How to disable added webparts in DeclarativeCatalogPart

Hello,

I have used webpart in my application's main page.

Working very nicely and effectively.

Now, My question is, I have DeclarativeCatalogPart to add web part on page.

that is even working fine.

I want to disable checkbox of that webpart which are already added on webpage. So, user cannot add it again.

and how can i hide dropdown box of webpartzone.

 

Regards,

ASIF

Do you have the code that you already have working, so that I can better understand what the checkbox you are speaking of is?