📄 defaultcs.aspx.cs
字号:
using System;
using System.Web.UI.WebControls;
using Telerik.WebControls;
namespace Telerik.EditorExamplesCSharp.Editor.Examples.EditorFilters
{
/// <summary>
/// Summary description for DefaultCS.
/// </summary>
public class DefaultCS : Telerik.QuickStart.XhtmlPage
{
#region Child controls
protected RadEditor editor1;
protected CheckBox cbStripAbsoluteAnchorPaths;
protected CheckBox cbStripAbsoluteImagesPaths;
protected CheckBox cbEnableHtmlIndentation;
protected CheckBox cbConvertTagToLower;
protected CheckBox cbConvertFontToSpan;
protected CheckBox cbConvertToXhtml;
protected CheckBox cbAllowScripts;
protected TextBox txtAnchorPathToStrip;
protected TextBox txtImagesPathToStrip;
protected Button btnApply;
#endregion
#region Event handlers
private void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
txtAnchorPathToStrip.Text = "http://" + Request.ServerVariables["SERVER_NAME"];
txtImagesPathToStrip.Text = "http://" + Request.ServerVariables["SERVER_NAME"];
cbAllowScripts.Checked = editor1.AllowScripts;
cbConvertTagToLower.Checked = editor1.ConvertTagsToLower;
cbConvertFontToSpan.Checked = editor1.ConvertFontToSpan;
cbConvertToXhtml.Checked = editor1.ConvertToXhtml;
cbStripAbsoluteAnchorPaths.Checked = editor1.StripAbsoluteAnchorPaths;
cbStripAbsoluteImagesPaths.Checked = editor1.StripAbsoluteImagesPaths;
SetEditorProperties();
}
}
private void btnApply_Click(object sender, EventArgs e)
{
SetEditorProperties();
}
#endregion
/// <summary>
/// The settings from the form fields are being applied to r.a.d.editor here.
/// </summary>
private void SetEditorProperties()
{
//Properties related to stripping the absolute Link href attribute
editor1.StripAbsoluteAnchorPaths = cbStripAbsoluteAnchorPaths.Checked;
editor1.AnchorPathToStrip = txtAnchorPathToStrip.Text;
//Properties related to stripping the absolute Image src attribute
editor1.StripAbsoluteImagesPaths = cbStripAbsoluteImagesPaths.Checked;
editor1.ImagesPathToStrip = txtImagesPathToStrip.Text;
//Enabling the conversion of the HTML tags to Xhtml compatible lower-case tags
editor1.ConvertTagsToLower = cbConvertTagToLower.Checked;
//Enabling the conversion of FONT tags to SPAN tags
editor1.ConvertFontToSpan = cbConvertFontToSpan.Checked;
//Enabling the conversion to Xhtml output
editor1.ConvertToXhtml = cbConvertToXhtml.Checked;
//Enabling the ability to insert client-side scripts in the content
editor1.AllowScripts = cbAllowScripts.Checked;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -