CODEDIGEST
Home Articles CodeDigest Tutorials FAQs
Home > CodeDigest >  
Technologies
 


Use RequiredFieldValidator control with TinyMCE editor in ASP.Net
Submitted By Satheesh Babu B
On 2/28/2010 6:11:34 AM
Tags: ASP.Net,CodeDigest  

Use RequireFieldValidator with TinyMCE editor in ASP.Net

 

The RequiredFieldValidator control will not work correctly when we use it with TinyMCE editor. This is due to the fact that the TinyMCE edior api will call a method called  tinyMCE.triggerSave during the form submit action to post back the entered text back to textarea from the editor instance. Read the documentation to know more about the method.

 

Hence, to make the RequiredFieldValidator to work call the triggerSave method for the Button click that is causing the postback.

 

Refer the code below,
<form id="form1" runat="server">
    <div>
    <B>Rich Text Editor</B>
    <asp:TextBox ID="TextBox1" TextMode="MultiLine" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
        ControlToValidate="TextBox1" ErrorMessage="*" ></asp:RequiredFieldValidator>
    </div>
    <asp:Button ID="Button1" runat="server" Text="Save" OnClientClick="tinyMCE.triggerSave(false,true);" onclick="Button1_Click" />
   
    </form>

 

Read my article, Using TinyMCE Editor in ASP.Net  to know more about TinyMCE editor.

Happy Coding!!


 

Recent Codes
  • View All Codes..