网上冲浪 | 反毒杀毒 | 菜鸟进阶 | 网络安全 | 实用技术 | 网络安全 | 操作系统 |
工具软件 | 电脑医院 | 网上赚钱 | 网页制作 | 网络营销 | 经典教程 | IT趣 谈 |
当前位置:IT快活林快活林学院网页制作

如何创建 Web 部件页


 
2. 单击控件(Controls)标题栏中的向下箭头以显示其谓词菜单,再单击“最小化”链接,请注意控件(Controls)已最小化。然后返回到谓词菜单,并单击“还原”。这阐释了 Web 部件(Components)控件(Controls)的不同视觉显示状态。
 使用户(Users)能够编辑页和更改布局
Web 部件(Components)为用户(Users)提供了更改 Web 部件(Components)控件(Controls)布局的能力,方法是将控件(Controls)从一个区域拖动到另一个区域。除允许用户(Users)将 WebPart 控件(Controls)从一个区域移到另一区域外,您还可以允许用户(Users)编辑控件(Controls)的不同特性,包括控件(Controls)的外观、布局和行为。Web 部件(Components)控件(Controls)集为 WebPart 控件(Controls)提供了基本的编辑功能。虽然在本演练中并不这样做,但您也可以创建自定义编辑器控件(Controls),用户(Users)可以使用这些控件(Controls)编辑 WebPart 控件(Controls)的特性。当 WebPart 控件(Controls)的位置发生更改时,对其属性的编辑将依赖于 ASP.NET 个性化设置来保存用户(Users)所做的更改。
在演练的此部分,将为用户(Users)增加能力来编辑页上任何 WebPart 控件(Controls)的基本特性。若要启用这些特性,请将另一个自定义用户(Users)控件(Controls)与一个 <asp:editorzone> 元素和两个编辑控件(Controls)一同添加到该页。
创建启用页布局更改功能的用户(Users)控件(Controls)
1. 在文本编辑器中的新文件内,粘贴下面的代码。这段代码将使用 Web 部件(Components)控件(Controls)集的功能,这些功能使页面能够更改其视图或显示模式,而且还使您能够在某些显示模式下更改页面的物理外观和布局。
Visual Basic   复制代码

<%@ control language="vb" classname="DisplayModeMenuVB"%>
<script runat="server">
  ' Use a field to reference the current WebPartManager control.
  Dim _manager As WebPartManager

  Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
    AddHandler Page.InitComplete, AddressOf InitComplete
  End Sub

  Sub InitComplete(ByVal sender As Object, ByVal e As System.EventArgs)
    _manager = WebPartManager.GetCurrentWebPartManager(Page)
     
    Dim browseModeName As String = _
      WebPartManager.BrowseDisplayMode.Name
     
    ' Fill the drop-down list with the names of supported display modes.
    Dim mode As WebPartDisplayMode
    For Each mode In _manager.SupportedDisplayModes
      Dim modeName As String = mode.Name
      ' Make sure a mode is enabled before adding it.
      If mode.IsEnabled(_manager) Then
        Dim item As New ListItem(modeName, modeName)
        DisplayModeDropdown.Items.Add(item)
      End If
    Next mode
     
    ' If Shared scope is allowed for this user, display the
    ' scope-switching UI and select the appropriate radio button
    ' for the current user scope.
    If _manager.Personalization.CanEnterSharedScope Then
      Panel2.Visible = True
      If _manager.Personalization.Scope = _
        PersonalizationScope.User Then
        RadioButton1.Checked = True
      Else
        RadioButton2.Checked = True
      End If
    End If
  End Sub

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  下一页

[]作者:佚名  来源:快活林整理