views:

78

answers:

1

I got one problem with showing error message to element.

Is there any option to turn on messages on place where is Html.ValidationMessageFor(model => model.ConfirmPassword). Becsoue for me it isn’t show up. I would like to have summary and near field information too not only red border. Any one know how to do it?

 using (Ajax.BeginForm("CreateValidForm", "Test", new AjaxOptions { HttpMethod = "Post" }))    {%> <div id="validationSummary1">
    <%= Html.ValidationSummary(true)%> </div> <fieldset>
    <legend>Fields</legend>
    <div class="editor-label">
        <%= Html.LabelFor(model => model.Name)%>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.Name)%>
        <%= Html.ValidationMessageFor(model => model.Name)%>
    </div>
    <div class="editor-label">
        <%= Html.LabelFor(model => model.Email)%>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.Email)%>
        <%= Html.ValidationMessageFor(model => model.Email)%>
    </div>
    <div class="editor-label">
        <%= Html.LabelFor(model => model.Password)%>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.Password)%>
        <%= Html.ValidationMessageFor(model => model.Password)%>
    </div>
    <div class="editor-label">
        <%= Html.LabelFor(model => model.ConfirmPassword)%>
    </div>
    <div class="editor-field">
        <%= Html.TextBoxFor(model => model.ConfirmPassword)%>
        <%= Html.ValidationMessageFor(model => model.ConfirmPassword)%>
    </div>
    <p>
        <input type="submit" value="Create" />
    </p> </fieldset> <% } %> <%= Html.ClientSideValidation<ValidModel>()
    .UseValidationSummary("validationSummary1", "Please fix the following problems:") %>

Here is link for sample project http://www.sendspace.com/file/m9gl54 .

A: 

Even with validationError parameter it doesn't work

  <%=Html.ValidationMessageFor(model => model.Name,"*")%>
ANDyW