0

我在 asp.net 网络表单中使用第三方所见即所得编辑器及其注册

<%@ Register TagPrefix="editor" Assembly="WYSIWYGEditor" Namespace="InnovaStudio" %>

这是返回的代码

<editor:WYSIWYGEditor runat="server" ID="txtDesc" />

在cs文件中,这是所见即所得的设置

        //'***************************************************
    //'   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";

我想提供必填字段验证。那么它怎么可能呢?

4

1 回答 1

0

我已经对此进行了一些阅读,看来您最好的解决方案是为您的控件实现自定义验证器,您可以毫无问题地提供客户端和服务器端实现 - 这是有关如何执行此操作的快速指南:

http://www.codeproject.com/Articles/3882/ASP-NET-Validators-Unclouded

请参阅自定义验证器部分。

于 2012-08-17T08:57:19.450 回答