ASP.NET 2.0(C#)中使用webpart系列控件(4)
来源:互联网 发布:初级u3d程序员工资 编辑:程序博客网 时间:2024/06/01 11:36
ASP.NET 2.0(C#)中使用webpart系列控件(4)
2、往该catlogzone控件区域中,再拖放三个Webpart系列的控件,分别是DeclarativeCatalogPart, PageCatalogPart, and ImportCatalogPart,如下图所示。其中,DeclarativeCatalogPart控件的作用是,显示目前页面上有哪些可以用的webpart控件;PageCatalogPart的作用是,可以让用户通过勾选的方式,选定将哪些控件添加转移到其他webpart区域中去。ImportCatalogPart则可以通过外部磁盘文件的方式,加载其他做好了的webpart部件。
3、在RadioButtonList区域中,修改以下代码,增添一个catalog display的显示模式:
<ASP:RadioButtonList ID="rblMode" runat="server" AutoPostBack="True">
<asp:ListItem>Browse Display Mode</asp:ListItem>
<asp:ListItem>Design Display Mode</asp:ListItem>
<asp:ListItem>Catalog Display Mode</asp:ListItem>
</asp:RadioButtonList>
然后,在code-behind的代码中,将代码修改为如下:
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch(rblMode.SelectedIndex)
{
case 0 :
{
WebPartManager1.DisplayMode =WebPartManager.BrowseDisplayMode ;
break ;
}
case 1 :
WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
break ;
case 2 :
WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
break;
}
}
4、在DeclarativeCatalogPart任务菜单上,点击右上角的智能感知按钮,然后选"edit templates"的链接,进入模版编辑状态,如下图:
再往其中的webpartstemplate区域中拖拉一个google.ascx控件,如下图,这将允许用户在运行时,可以自由地往页面增加这样的google搜索控件。
5、然后修改代码如下:
<ZoneTemplate>
<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server">
<WebPartsTemplate>
<uc1:Google title="Google Search" ID="Google2" runat="server" />
</WebPartsTemplate>
</asp:DeclarativeCatalogPart>
6、运行程序,可以看到,当选择catalog display mode时,会显示如下图所示的catalog zone,其中列出了当前可用的有哪些webpart控件,我们可以把这个google的控件加到其他的webpart区域,也可以尝试将已经存在的webpart控件关闭,然后在catalog zone区域中的控件列表中,把它们再加回到页面中去。
- ASP.NET 2.0(C#)中使用webpart系列控件(4)
- ASP.NET 2.0(C#)中使用webpart系列控件(3)
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件(1)
- ASP.NET 2.0中使用webpart系列控件(2)
- ASP.NET 2.0中使用webpart系列控件
- ASP.NET 2.0中使用webpart系列控件
- Asp.net 2.0 WebPart使用经验点滴
- Asp.net 2.0 WebPart使用经验点滴
- Asp.net 2.0 WebPart使用经验点滴
- Asp.net 2.0 WebPart使用经验点滴
- 宁宇
- 组图:剑走偏锋 系统工具也杀毒
- 自己开发DB2工具 (11)
- ASP.NET 2.0中使用webpart系列控件(2)
- ASP.NET 2.0(C#)中使用webpart系列控件(3)
- ASP.NET 2.0(C#)中使用webpart系列控件(4)
- 两表连接,如果连接的表中有两条以上匹配的记录,只选出第一条
- 微软发最后通牒强娶雅虎
- VC环境中MapX一次删除图层所有图元
- Asp.net 2.0 WebPart使用经验点滴
- 中国示范性软件学院大工规模第一
- [技术讨论]iTSP组04年关于知识库构建的对话
- 马化腾:人才短缺制约广东互联网发展
- MYSQL的精简开发包