Validate HTML TextArea using RequiredFieldValdiator in ASP.Net

Last Reply on Sep 30, 2014 03:40 AM By Mudassar

Posted on Sep 30, 2014 03:39 AM

How do I validate HTML TextArea using RequiredFieldValdiator in ASP.Net?

 

Posted on Sep 30, 2014 03:40 AM Modified on on Oct 09, 2014 11:45 PM

You cannot. You will need to use CustomValidator.

HTML

 

Message:  
<textarea id="textarea11"></textarea>
<br />
<asp:CustomValidator ID="CustomValidator1" ErrorMessage="Please enter some message"
    runat="server" ClientValidationFunction="MessageValidation" />
<br />
<asp:Button ID="Button1" Text="Save" runat="server" />
<script type="text/javascript">
    function MessageValidation(sender, args) {
        var message = document.getElementById("textarea11").value;
        if (message == "") {
            args.IsValid = false;
        }
        else {
            args.IsValid = true;
        }
    }
</script>

Screenshot

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html