对话内容
<div id="div_dialog_container" class="dialog_container">
@using (Html.BeginForm((string)ViewBag.FormAction, "Musteri"))
{
<div id="div_iu_form_container" class="ui_form_container">
<div>@Html.ValidationSummary(true, "Müşteri Kaydı Başarısız! Lütfen Bilgileri Kontrol Ediniz.")
</div>
<table>
<thead>
<tr>
<th colspan="2">Genel Bilgiler</th>
</tr>
</thead>
<tbody>
<tr>
<td>@Html.LabelFor(x => x.musteri_no):</td>
<td>@Html.TextBoxFor(x => x.musteri_no)
@Html.ValidationMessageFor(x => x.musteri_no)</td>
</tr>
<tr>
<td>@Html.LabelFor(x => x.musteri_adi):</td>
<td>@Html.TextBoxFor(x => x.musteri_adi)
@Html.ValidationMessageFor(x => x.musteri_adi)</td>
</tr>
<tr>
<td>@Html.LabelFor(x => x.sektor):</td>
<td>@Html.TextBoxFor(x => x.sektor)
@Html.ValidationMessageFor(x => x.sektor)</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>
控制器
[HttpPost]
public JsonResult JsonMusteriDuzenle(TblMusteriler musteri, string returnUrl)
{
if (ModelState.IsValid)
{
try
{
mus_dbo.update_musteri(musteri);
return Json(new { success = true, redirect = returnUrl });
}
catch (Exception e)
{
ModelState.AddModelError("", "Müşteri güncelleme hatası.");
}
}
return Json(new { errors = GetErrorsFromModelState() });
}
我想显示文本框的错误按钮。但它显示在顶部,如下所示:
如何显示每个文本框自己的错误?
我要这个:
谢谢。