MVC 4 validation

I have setup validation in the Model and on the Front end, I have added the necessary scripts, I have triple checked this.

I am not using the Razor View engine but .aspx view.

My textboxes I am trying to validate are TextBoxFor and than I have the ValidateMessageFor.

I have verified the web.config files and added this to the Global.asax file

   HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
            HtmlHelper.ClientValidationEnabled = true;

I am using Kendo UI and I went through all there steps here

Validation still isn’t working?

Are there any Code examples for this?

I tried plain UI input text boxes and used the Required attribute and these didn’t work.

I need to use the Model so this isn’t practical.

Post your model code, let us see so that we can help you out.

HTML elements below.

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div class="cc">
                    <label>Cc Email Address(es)
                     <%: Html.TextBoxFor(m => m.EmailCC, new { id ="emailCC"} )%>
                        <%: Html.ValidationMessageFor(m => m.EmailCC)%>

                <div class="subject">
                    <label>Email Subject                        
                        <%: Html.TextBoxFor(m => m.EmailSubject, new { id = "ecardSubject" }) %>
                        <%: Html.ValidationMessageFor(m => m.EmailSubject) %>

Validation is setup in the model with a required attribute.


<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsSection" runat="server">

    <script src="../../Scripts/jquery-1.8.2.js"></script>
    <script src="../../Scripts/jquery.validate.js"></script>

<script src="../../Scripts/jquery.validate.unobtrusive.js"></script>

Does the back end validation work. Remember they are two kinds of validation. Front end and back end. Kindly state the one that is not working.

Your code looks right. still trying to figure out what the problem is

We are trying to do front end validation.


Please use the develop tool to check whether these JS files are loaded correctly.

On the other hand, please share the project on the OneDrive, we will check it.

Best Regards


One Drive? What code did you want to see? the html and the back end?


Base on the code, I don’t fine any issue.

Please try it in a new project. If you could reproduce that issue, share this project on the OneDrive.

Best Regards


Leave a Reply