What you've written is wrong.
You're got the view strongly typed but then you're not using the strongly typed properties or validation messages. Also, you've got the validation summary outside the form.. which won't work.
@using (Html.BeginForm())
@Html.ValidationSummary(true)
Then, you'll need to do something like this:
<table>
@foreach (ShoppingClass shoppingClass in Model) {
<tr>
<td>@Html.LabelFor(x => x.BrandName)
</td>
<td>@Html.TextBoxFor(x => x.BrandName)
<div>
@Html.ValidationMessageFor(x => x.BrandName)</div>
</td>
</tr>
}
</table>
<input type="submit" value="Search" name="Search" />
I'm not sure why you have a Search button for every item that goes to the same controller and action.. but I'll leave that for you to figure out.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…