client side validation in ascx files (user controls) for asp.net mvc
Posted
by Sefer KILIÇ
on Stack Overflow
See other posts from Stack Overflow
or by Sefer KILIÇ
Published on 2010-05-11T18:30:06Z
Indexed on
2010/05/11
18:34 UTC
Read the original article
Hit count: 356
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>
<% } %>
© Stack Overflow or respective owner