Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As you told me you are using MVC, We have an <strong>Remote</strong> Validation in MVC which we can apply in our <strong>Model Class Properties</strong>. </p> <p>Let me show you how:</p> <pre><code>[Required] [Remote("IsUserIDExist", "Account", ErrorMessage = "User ID Already Exist")] [Display(Name = "Enter User ID")] public string User_username { get; set; } </code></pre> <p>This is my Property which is in <strong>Account.cs</strong> Model Class.</p> <p><strong>IsUserIDExist</strong> is the Action in <strong>Account</strong> Controller.</p> <p>Now let me show you <strong>IsUserIDExist</strong> Action.</p> <pre><code>public ActionResult IsDomainIDExist(string User_username) { var users = from s in db.CreateUsers where s.User_username == User_username select s; if (users != null) { if (users.Count() != 0) { return Json(false, JsonRequestBehavior.AllowGet); } else { return Json(true, JsonRequestBehavior.AllowGet); } } else { return Json(true, JsonRequestBehavior.AllowGet); } } </code></pre> <p>This Code speaks it self.I guess there is no need for any explanation.</p> <p>Last but not least.</p> <p>You need to add these javascript files to work with Remote Validation</p> <pre><code>&lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt; &lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.json-2.2.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p></p> <p>Hope this is what you were looking for.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload