⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editmode.aspx.cs

📁 《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含的源代码.非常经典的一本asp.net2.0的书籍
💻 CS
字号:
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 Editor : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		if (!User.Identity.IsAuthenticated)
		{
			FormsAuthentication.RedirectToLoginPage();
		}
    }

	//进入编辑模式
	protected void btnEditorMode_Click(object sender, EventArgs e)
	{
		if (WebPartManager1.DisplayMode == WebPartManager.BrowseDisplayMode)
		{
			WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode;
			btnEditorMode.Text = "结束编辑模式";
		}
		else
		{
			WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
			btnEditorMode.Text = "进入编辑模式";
		}
	}

	//切换个性化Scope
	protected void btnToggle_Click(object sender, EventArgs e)
	{
		if ((WebPartManager1.Personalization.Scope == PersonalizationScope.User) && (WebPartManager1.Personalization.CanEnterSharedScope))
		{
			WebPartManager1.Personalization.ToggleScope();
		}
		else
		{
			if (WebPartManager1.Personalization.Scope == PersonalizationScope.Shared)
			{
				WebPartManager1.Personalization.ToggleScope();
			}
			else
			{
				txtMsg.Text = "<script>alert('个性化Scope无法切换到Shared')</script>";
			}
		}
	}
}

⌨️ 快捷键说明

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