client side validation in ascx files (user controls) for asp.net mvc
- by Sefer KILIÇ
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, "Giris basarisiz oldu. Lütfen hatalari 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="Giris" />
</p>
</fieldset>
</div>
<% } %>