看法
@model Osos12Mvc3.Models.TblSayaclar
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div id="div_dialog_container" class="dialog_container">
@using (Html.BeginForm((string)ViewBag.FormAction, "Sayac"))
{
<div id="div_iu_form_container" class="ui_form_container">
<div>@Html.ValidationSummary(true, "Sayaç 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.TblMusteriler.musteri_adi):
</td>
<td>@Html.DropDownList("sno", (SelectList)ViewBag.musteri_id, "--Müşteri Seçiniz--")
</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
<table class="table_ui_buttons">
<thead>
<tr>
<th colspan="2">
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="submit" value="Kaydet" />
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
}
</div>
控制器
public ActionResult SayacEkle()
{
var musteriler = entity.TblMusteriler.Select(x => new { x.sno, x.musteri_adi });
ViewBag.musteri_id = new SelectList(musteriler.AsEnumerable(), "sno", "musteri_adi");
return ContextDependentView(new TblSayaclar());
}
在我看来,我正在使用验证摘要。当我单击提交下拉列表颜色更改为红色。(如必填字段)。我不明白那种状态。我调试了发布事件,它没有发布。发布操作未触发。
这是 Html 源代码:
<select data-val="true" data-val-number="The field sno must be a number." data-val-required="The sno field is required." id="sno" name="sno" class="input-validation-error"><option value="">--Müşteri Seçiniz--</option>
AliRıza Adıyahşi
有什么问题?
谢谢