Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)

<textarea cols="80" id="editor1" name="editor1" rows="10" runat="server" clientidmode="Static"
style="width: 900px;">
</textarea>
<asp:requiredfieldvalidator id="requiredfieldvalidator3" runat="server"
controltovalidate="editor1" display="none"
errormessage="enter template text" setfocusonerror="true"
validationgroup="A">
<asp:validatorcalloutextender id="requiredfieldvalidator3_validatorcalloutextender"
runat="server" targetcontrolid="requiredfieldvalidator3">


<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"
OnLoad="btnSave_Load" ValidationGroup="A" />
Posted
Updated 4-Feb-14 22:10pm
v2

Try adding the ValidationGroup attribute to your TextArea control:

... something like this:
ASP.NET
<textarea cols="80" id="editor1" name="editor1" rows="10"  runat="server" validationgroup="A" clientidmode="Static" style="width: 900px;"></textarea>
 
Share this answer
 
v2
Comments
[no name] 5-Feb-14 4:23am    
i tried but its not working ..
hypermellow 5-Feb-14 4:38am    
You could also replace your textarea html control with an aspnet textbox, specifiying the multiline textmode.

Something like:
<asp:TextBox id="editor1" TextMode="multiline" runat="server" cols="80" rows="10" clientidmode="Static" ValidationGroup="A" style="width: 900px;" />

... if this doesn't help, then there must be something else on your page that causing the issue.
[no name] 5-Feb-14 4:45am    
TextMode property is not there because its CKEDITOR
hypermellow 5-Feb-14 5:01am    
Does it make any difference if you add EnableClientScript="False" to the RequiredFieldValidator ?
hypermellow 5-Feb-14 5:05am    
... this seems to provide a workaround to the issue.

http://codes.codedigest.com/CodeDigest/155-Using-RequiredField-Validator-with-CKEditor-in-ASP-Net.aspx
remove the property display none of requiredfieldvalidator
provide initial value to requiredfieldvalidator
 
Share this answer
 
Comments
[no name] 5-Feb-14 4:31am    
When i am providing initial value=0 its not validating .. its allowing button to save
suppose initial value is 0 assign this value to ur textbox at design time or load time when user change this value to 10 and again insert 0 then it will work

its better u use javascript

XML
<script type="text/javascript">
       function valid() {
           var v_type = document.getElementById("<%=Voucher_Type.ClientID%>").value;
          
           //var sales = document.getElementById("editor1").value;
          if (v_type == "--Select--" )
           {
               alert("fill all information");
               return false;
           }
           else {
              
                   return true;              

           }
         
       }
   </script>



<asp:button id="btnSave" runat="server" text="Save" onclick="btnSave_Click" onclientclick="return valid();" xmlns:asp="#unknown">
 
Share this answer
 
Comments
[no name] 5-Feb-14 5:08am    
Its not working its effecting to other textbox validations also

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900