如何将Html.Validation()。FormValidation()添加到Html.BeginForm

时间:2022-10-19 04:04:53

If I have this code:

如果我有这个代码:

<% using (Html.BeginForm("CreateItem", "Item", FormMethod.Post, new { enctype = "multipart/form-data" })) { %> 
    <label for="ItemImage">Item Image:</label>
    Please use JPEG file format only.<br />
    <input type="file" name="file" />
    <%= Html.ValidationMessage("ItemImage", "*") %>
<% } %>

And I want to use MvcContrib to catch bug, how do I add html.validation on html.beginform?

我想使用MvcContrib来捕获bug,如何在html.beginform上添加html.validation?

1 个解决方案

#1


Take a look at the "NerdDinner" sample application. They do validation in there.

看一下“NerdDinner”示例应用程序。他们在那里进行验证。

If you can't find it then add a comment to this answer and I'll provide code.

如果您找不到它,请在此答案中添加注释,我将提供代码。

#1


Take a look at the "NerdDinner" sample application. They do validation in there.

看一下“NerdDinner”示例应用程序。他们在那里进行验证。

If you can't find it then add a comment to this answer and I'll provide code.

如果您找不到它,请在此答案中添加注释,我将提供代码。