Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%:Html.DropDownListFor(m=>m.FatherId,Model.father,new{id="drpFatherId",disabled="true"})%>
- <%:Html.TextBoxFor(m => m.FatherName, new { id = "txtfatherName"})%><br />
- <span style="color:Red;" id="Error"></span>
- $("input#txtfatherName").change(function () {
- //alert("message");
- var term = $(this).val();
- $.ajax(
- {
- url: 'Home/getFatherId',
- type: 'POST',
- data: { term: term },
- dataType: 'json',
- Success: function (data) {
- if (data != 0) {
- $("#drpFatherId").val(data);
- document.getElementById("Error").innerHTML = "";
- }
- else {
- $("#drpFatherId").val(0);
- document.getElementById("Error").innerHTML = "Our System does not recognize this father name. please try again.";
- $("#txtfatherName").focus();
- }
- }
- });
- });
- public JsonResult getFatherId(string term)
- {
- int fatherId = 0;
- using (ManageMembers mngMembrs = new ManageMembers())
- {
- Member data = mngMembrs.getFatherID(term);
- if (data != null)
- fatherId = data.ID;
- }
- return Json(fatherId, JsonRequestBehavior.AllowGet);
- }
Add Comment
Please, Sign In to add comment