[HttpPost] public ActionResult Register(tbl_User model) { if (ModelState.IsValid) { if (MyClass.IsUserNameDuplicate(model.username) == true) { this.ModelState.AddModelError("username", "user name is duplicate"); return View(model); } else { MyClass.creatUser(model.username, model.password_User, model.nam); } } return View(model); }
@Html.ValidationSummary(true) @Html.ValidationMessageFor(model => model.username) @Html.TextBoxFor(m => m.username, new {@class = "input", @placeholder = "*enter your username" })
ModelState.AddModelError("", "user name is duplicate");
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)