为WYSIWYG编辑器
问题描述:
我正在使用asp.net web表单第三方WYSIWYG编辑器以及它与为WYSIWYG编辑器
<%@ Register TagPrefix="editor" Assembly="WYSIWYGEditor" Namespace="InnovaStudio" %>
这里需要注册字段验证为代码在CS文件返回
<editor:WYSIWYGEditor runat="server" ID="txtDesc" />
这是设置为wysiwyg
//'***************************************************
//' SETTING EDITOR DIMENSION (WIDTH x HEIGHT)
//'***************************************************
//'***************************************************
//' SETTING EDITING MODE
//'
//' Possible values:
//' - "HTMLBody" (default)
//' - "XHTMLBody"
//' - "HTML"
//' - "XHTML"
//'***************************************************
txtDesc.EditMode = "XHTMLBody";
//'***************************************************
//' SETTING EDITOR DIMENSION (WIDTH x HEIGHT)
//'***************************************************
txtDesc.EditorWidth = 750.ToString(); //'You can also use %, for example: oEditSummary.EditorWidth = "100%"
txtDesc.EditorHeight = 450.ToString();
//'***************************************************
//' SHOWING DISABLED BUTTONS
//'***************************************************
txtDesc.btnPrint = true;
txtDesc.btnPasteText = true;
txtDesc.btnFlash = true;
txtDesc.btnMedia = true;
txtDesc.btnLTR = true;
txtDesc.btnRTL = true;
txtDesc.btnSpellCheck = true;
txtDesc.btnStrikethrough = true;
txtDesc.btnSuperscript = true;
txtDesc.btnSubscript = true;
txtDesc.btnClearAll = true;
txtDesc.btnStyles = true; //'Show "Styles/Style Selection" button
//'***************************************************
//' SPECIFY onSave EVENT COMMAND
//'***************************************************
//oEditSummary.onSave="document.forms.Form1.elements.btnSubmit.click();"
//'***************************************************
//' APPLYING STYLESHEET
//' (Using external css file)
//'***************************************************
txtDesc.Css = "style/test.css"; //'Specify external css file here
//'***************************************************
//' APPLYING STYLESHEET
//' (Using predefined style rules)
//'***************************************************
//'oEditSummary.StyleList = New String(,){ _
//' {"BODY",false,"","font-family:Verdana,Arial,Helvetica;font-size:x-small;"}, _
//' {".ScreenText",true,"Screen Text","font-family:Tahoma;"}, _
//' {".ImportantWords",true,"Important Words","font-weight:bold;"}, _
//' {".Highlight",true,"Highlight","font-family:Arial;color:red;"}}
//'If you'd like to set the default writing to "Right to Left", use:
//'oEditSummary.StyleList = New String(,){{"BODY",false,"","direction:rtl;unicode-bidi:bidi-override;"}}
//'***************************************************
//' ENABLE ASSET MANAGER ADD-ON
//'***************************************************
txtDesc.AssetManagerWidth = 570.ToString();
txtDesc.AssetManagerHeight = 510.ToString();
txtDesc.AssetManager = System.Configuration.ConfigurationManager.AppSettings["EditorPath"].ToString() + "/Editor/assetmanager/assetmanager.aspx";
txtDesc.scriptPath = System.Configuration.ConfigurationManager.AppSettings["EditorPath"].ToString() + "/Editor/scripts/";
//'Use relative to root path (starts with "/")
//'***************************************************
//' USING CUSTOM TAG INSERTION FEATURE
//'***************************************************
txtDesc.CustomTagList = new String[,]{{"First Name","{%first_name%}"},
{"Last Name","{%last_name%}"},
{"Email","{%email%}"}};
//'***************************************************
//' SETTING COLOR PICKER's CUSTOM COLOR SELECTION
//'***************************************************
txtDesc.CustomColors = new String[] { "#ff4500", "#ffa500", "#808000", "#4682b4", "#1e90ff", "#9400d3", "#ff1493", "#a9a9a9" };
//'***************************************************
//' SETTING EDITING MODE
//'
//' Possible values:
//' - "HTMLBody" (default)
//' - "XHTMLBody"
//' - "HTML"
//' - "XHTML"
//'***************************************************
txtDesc.EditMode = "XHTMLBody";
我想给予必要的字段验证。 那么如何可能?
答
我已经做了一些阅读,看来你最好的解决方案是为你的控件实现一个自定义验证器,你可以提供客户端和服务器端实现没有问题 - 继承人快速指南如何做到这一点:
http://www.codeproject.com/Articles/3882/ASP-NET-Validators-Unclouded
请参阅“自定义验证器”一节。