ASP.NET MVC Validation Controls

Rating:        Based on 1 rating
Reviewed:  0 reviews
Downloads: 223
Released: Oct 22, 2009
Updated: Nov 24, 2009 by guramrit
Dev status: Stable Help Icon

Recommended Download

Application Classic.Mvc.Web.UI.dll
application, 26K, uploaded Oct 22, 2009 - 223 downloads

Release Notes

Project Description

This library is complete set of Validation Controls for ASP.NET MVC imported from ASP.NET WebForms in MVC Style, which are used in WebForms. It makes client side validation easier both for Developer and Designer with less code. It's developed in C#.


Feedback requested

USAGE:

On Web.Config

<pages>
  <controls>
    <add tagPrefix="v" namespace="Classic.Mvc.Web.UI" assembly="Classic.Mvc.Web.UI"/>
  </controls>
  <namespaces>
    <add namespace="Classic.Mvc.Web.UI"/>
  </namespaces>
</pages>

On Site.Master

<v:ValidatorScriptManager runat="server"></v:ValidatorScriptManager>

On View (eg. Index.aspx)

<%=Html.ValidationSummary("aaa",
        props =>
            {
				props.ShowSummary = true;
				props.ShowMessageBox = true;
				props.ValidationGroup = "test";
            })%>

<input id="username" />
<%= Html.RequiredFieldValidator("reqVal_ username", "username",
        options =>
            {
                options.Text = "*";
                options.ErrorMessage = "Invalid Username";
                options.SetFocusOnError = true;
                options.ValidationGroup = "test";
            })%>
in submit handler of form (in javascript block or file) use following statements to check validity of controls and block submission of form
 if(!Page_ClientValidate("test")){
    return false;
}
"test" is validation group. You can use ValidationGroup to distinguish between forms

Reviews for this release