ASP.NET Tutorial/WebPart/WebPartZone

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Creating multiple Web zones

   <source lang="csharp">

<%@ Page Language="VB"%>

<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">

   <title>Web Parts Example</title>

</head> <body>

   <form id="form1" runat="server">
       <asp:WebPartManager ID="Webpartmanager1" runat="server">
       </asp:WebPartManager>
                   <asp:WebPartZone ID="WebPartZone1" 
                                    runat="server"
                                    LayoutOrientation="Horizontal">
                       <ZoneTemplate>
                           <asp:Label ID="Label1" 
                                      runat="server" Text="Label"
                                      Title="Welcome to my web page!">
                                      Welcome to the page!
                           </asp:Label>
                       </ZoneTemplate>
                   </asp:WebPartZone>
                   <asp:WebPartZone ID="WebPartZone2" runat="server">
                       <ZoneTemplate>
                           <asp:Image ID="Image1" runat="server"
                            ImageUrl="~/Images/Kids.jpg" Width="150px"
                            Title="My Kids">
                           </asp:Image>
                       </ZoneTemplate>
                   </asp:WebPartZone>
                   <asp:WebPartZone ID="WebPartZone3" runat="server">
                       <ZoneTemplate>
                           <asp:Calendar ID="Calendar1" runat="server"
                            Title="Calendar">
                           </asp:Calendar>
                       </ZoneTemplate>
                   </asp:WebPartZone>
   </form>

</body> </html></source>


Graying out the Close link in a Web Part

   <source lang="csharp">

<asp:WebPartZone ID="WebPartZone3" Runat="server">

     <CloseVerb Enabled="False" />
     <ZoneTemplate>
        <asp:Calendar ID="Calendar1" Runat="server">
        </asp:Calendar>
     </ZoneTemplate>

</asp:WebPartZone></source>


Removing the Close link in a Web Part

   <source lang="csharp">

<asp:WebPartZone ID="WebPartZone3" Runat="server">

     <CloseVerb Visible="False" />
     <ZoneTemplate>
        <asp:Calendar ID="Calendar1" Runat="server">
        </asp:Calendar>
     </ZoneTemplate>

</asp:WebPartZone></source>


Turning off the zone modification capability

   <source lang="csharp">

<asp:WebPartZone ID="WebPartZone1"

                runat="server" 
                LayoutOrientation="Horizontal" 
                AllowLayoutChange="false">
     <ZoneTemplate>
     <asp:Label ID="Label1" 
                runat="server" 
                Text="Label"
                Title="Welcome to my web page!">
                Welcome to the page!
     </asp:Label>
     </ZoneTemplate>

</asp:WebPartZone></source>


Using images for the Web Part verbs

   <source lang="csharp">

<asp:WebPartZone ID="WebPartZone3" Runat="server">

     <CloseVerb ImageUrl="Images/CloseVerb.gif" />
     <MinimizeVerb ImageUrl="Images/MinimizeVerb.gif" />
     <ZoneTemplate>
        <asp:Calendar ID="Calendar1" Runat="server">
        </asp:Calendar>
     </ZoneTemplate>

</asp:WebPartZone></source>