webpartmanagerpanel.ascx.cs

来自「asp.net 2.0 WebPart应用. 使用Web部件创建模块化的Web」· CS 代码 · 共 64 行

CS
64
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WebPartManagerPanel : System.Web.UI.UserControl
{
	protected void Page_Load(object sender, EventArgs e)
	{
		// Based on WebPartManager's capabilities, show / hide options for 
		// switching display modes of the page.
		//
		_browseViewLabel.Visible =
			WebPartManager1.SupportedDisplayModes.Contains(WebPartManager.BrowseDisplayMode);
		_catalogViewLabel.Visible =
			WebPartManager1.SupportedDisplayModes.Contains(WebPartManager.CatalogDisplayMode);
		_connectViewLabel.Visible =
			WebPartManager1.SupportedDisplayModes.Contains(WebPartManager.ConnectDisplayMode);
		_designViewLabel.Visible =
			WebPartManager1.SupportedDisplayModes.Contains(WebPartManager.DesignDisplayMode);
		_editViewLabel.Visible =
			WebPartManager1.SupportedDisplayModes.Contains(WebPartManager.EditDisplayMode);
		_personalizationModeToggleLabel.Visible =
			WebPartManager1.Personalization.CanEnterSharedScope;
	}
	protected void cmdBrowseView_Click(object sender, EventArgs e)
	{
		WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;

	}
	protected void cmdDesignView_Click(object sender, EventArgs e)
	{
		WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;

	}

	protected void cmdEditView_Click(object sender, EventArgs e)
	{
		WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;

	}
	protected void cmdConnectView_Click(object sender, EventArgs e)
	{
		WebPartManager1.DisplayMode = WebPartManager.ConnectDisplayMode;

	}

	protected void cmdCatalogView_Click(object sender, EventArgs e)
	{
		WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;

	}

	protected void cmdPersonalizationModeToggle_Click(object sender, EventArgs e)
	{
		WebPartManager1.Personalization.ToggleScope();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?