2013年6月7日 星期五

DropDownListFor 驗證失效

mvc3 下 DropDownList驗證失效加入以下即可解決
new { data_val_required = "請輸入類別", data_val = "true" }

@Html.DropDownListFor(m => m.DepartmentID, (SelectList)ViewBag.DepartmentID, "==請選擇部門==", new { data_val_required = "*", data_val = "true" })

Visual Studio JS intellisense 失效解決方式

  試了好久,發現到工具>選項>IntelliCode js項目設定啟用,重新開啟VS就正常了! 後來發現是TypeScript3.2版有問題停用,使用4.3版的TypeScript即可