views:

309

answers:

1

hi,

I have a logOn forn in ascx files and I render it as partial. How I can add a clinet side validation to this form, have any idea ?

My below code does not work

<%= Html.ValidationSummary(true, "Giriş başarısız oldu. Lütfen hataları düzeltip tekrar deneyin.") %>
    <% Html.EnableClientValidation(); %> 
    <% using (Html.BeginForm("LogOnProcess", "Account")) { %>
        <div>
            <fieldset>
                <legend>Hesap Bilgileri</legend>

                <div class="editor-label">
                    <%= Html.LabelFor(m => m.UserName) %>
                </div>
                <div class="editor-field">
                    <%= Html.TextBoxFor(m => m.UserName) %>
                    <%= Html.ValidationMessageFor(m => m.UserName) %>
                </div>

                <div class="editor-label">
                    <%= Html.LabelFor(m => m.Password) %>
                </div>
                <div class="editor-field">
                    <%= Html.PasswordFor(m => m.Password) %>
                    <%= Html.ValidationMessageFor(m => m.Password) %>
                </div>

                <div class="editor-label">
                    <%= Html.CheckBoxFor(m => m.RememberMe) %>
                    <%= Html.LabelFor(m => m.RememberMe) %>
                </div>

                <p>
                    <input type="submit" value="Giriş" />
                </p>
            </fieldset>
        </div>
    <% } %>
+1  A: 

I had issues with the built in client side validation in some ascx pages. What I had to do was use the jQuery validation to achieve this. Check out this link:

http://docs.jquery.com/Plugins/Validation

Jack