?? edithtmlpage.cs
字號:
namespace ASPNET.StarterKit.Communities.HtmlPage {
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using ASPNET.StarterKit.Communities;
//*********************************************************************
//
// EditHtmlPage Class
//
// Represents the Edit HTML page. Enables users to edit HTML content.
//
//*********************************************************************
public class EditHtmlPage : ContentEditPage {
string _skinFileName = "HtmlPage_EditHtmlPage.ascx";
string _sectionContent = "ASPNET.StarterKit.Communities.HtmlPage.HtmlPage";
HtmlTextBox txtContent;
//*********************************************************************
//
// SkinLoadHtmlPage
//
// The skin load event happens after a page skin has been loaded.
// Here, we grab the necessary controls from the page skin.
//
//*********************************************************************
void SkinLoadHtmlPage(Object s, SkinLoadEventArgs e) {
// Find the Content TextBox
txtContent = (HtmlTextBox)GetControl(e.Skin, "txtContent");
}
//*********************************************************************
//
// OnLoad Method
//
// Assign previous content values to edit form.
//
//*********************************************************************
override protected void OnLoad(EventArgs e) {
EnsureChildControls();
if (!Page.IsPostBack)
txtContent.Text = HtmlPageUtility.GetHtmlPage(objSectionInfo.ID);
}
//*********************************************************************
//
// SubmitHtmlPage Method
//
// This method is raised by clicking the Edit button in the Edit
// form.
//
//*********************************************************************
private void SubmitHtmlPage(Object s, EventArgs e) {
if (Page.IsValid) {
HtmlPageUtility.UpdateHtmlPage(objSectionInfo.ID,txtContent.Text);
Context.Response.Redirect( CommunityGlobals.CalculatePath( "Default.aspx" ) );
}
}
//*********************************************************************
//
// EditHtmlPage Constructor
//
// Calls the base SkinnedCommunityControl constructor
// and assigns the default page skin. Also checks whether
// current user has permissions to edit.
//
//*********************************************************************
public EditHtmlPage() : base() {
// Assign a default skin file name
SkinFileName = _skinFileName;
// Assign section content
SectionContent = _sectionContent;
// Wire-up event handlers
this.SkinLoad += new SkinLoadEventHandler(SkinLoadHtmlPage);
this.Submit += new SubmitEventHandler(SubmitHtmlPage);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -