Tuesday, September 20, 2011

TinyMCE Editor

Integrate TinyMce Editor in Asp.Net with Validation

 


1. Place TinyMceWrapper.dll, TinyMceWrapper.pdb   in your Bin Folder.

2. Register it in your web page i.e
   
<%@ Register Assembly="TinyMceWrapper" Namespace="TinyMceWrapper.Web.UI" TagPrefix="tmw" %>
<%@ Register Assembly="TinyMceWrapper" Namespace="TinyMceWrapper.Web.UI.WebControls" TagPrefix="tmw" %>
 


3. On the page (use ValidateRequest="false")
 
<tmw:TinyMceScriptManager ID="TinyMceScriptManager1"  runat="server" />

 <tmw:TinyMce ID="TinyMce"  runat="server" />

 <tmw:TinyMceValidator ID="TinyMceValidator1"   runat="server"
           ControlToValidate="TinyMce"
           ErrorMessage="You must type something in the above TinyMce editor."
           IsRequired="True"
           MaximumLength="80000"
           Display="Dynamic" />

----------------------------------------------------------

4. In Web.Config File, place the following snippet


<configuration>
       <configSections>
              <section name="tinymce" type="TinyMceWrapper.Web.Configuration.TinyMceSection, TinyMceWrapper" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
       </configSections>


       <tinymce scriptPath="~/tiny_mce" xmlns="urn:schemas-tinymce">
              <displayModes>
                     <add name="Simple">
                           <options>
                                  <add key="mode" value="exact"/>
                                  <add key="theme" value="advanced"/>
                                  <add key="language" value="en"/>
                                  <!--<add key="plugins" value="safari,emotions,directionality,paste,emotions" />-->
                                  <!--<add key="theme_advanced_buttons1" value="bold,italic,underline,strikethrough,|,outdent,indent,ltr,rtl,|,bullist,numlist,|,link,unlink,image,|,cut,copy,paste,pastetext,pasteword,|,code,|,formatselect,|,emotions" />
          <add key="theme_advanced_buttons2" value="tablecontrols" />
          <add key="theme_advanced_buttons3" value="" />
          <add key="theme_advanced_buttons4" value="" />-->
                                  <add key="plugins" value="safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager"/>
                                  <add key="theme_advanced_buttons1" value="save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect"/>
                                  <add key="theme_advanced_buttons2" value="cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor"/>
                                  <add key="theme_advanced_buttons3" value="tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen"/>
                                  <add key="theme_advanced_buttons4" value=""/>
                                  <add key="theme_advanced_toolbar_location" value="top"/>
                                  <add key="theme_advanced_toolbar_align" value="left"/>
                                  <add key="theme_advanced_path_location" value="bottom"/>
                                  <add key="theme_advanced_resizing" value="true"/>
                                  <add key="skin" value="o2k7"/>
                                  <add key="content_css" value="themes/styles.css" urlOption="true"/>
                           </options>
                     </add>
              </displayModes>
       </tinymce>
      


<appSettings/>
<connectionStrings/>


-------------------------------------------------

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More