asp .net MVC 2.0 xval验证元素

时间:2010-05-28 08:31:14

标签: asp.net-mvc-2 xval

我向元素显示错误消息时出现了一个问题。

是否有任何选项可以打开Html.ValidationMessageFor(model => model.ConfirmPassword)的地方的消息。对我而言,它并没有出现。我想有总结和近场信息,不仅是红色边框。谁知道怎么做?

 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:") %>

以下是示例项目http://www.sendspace.com/file/m9gl54的链接。

0 个答案:

没有答案