Hi I have two fields in my view CustomerName and ContactPerson. Before i kept these two field as dropdown field. Now I change the customer name field as autoComplete textbox and contact person field as dropdown field.
Before i kept these two field as Cascading dropdown fields.That is if i select theCusomerName the CustomerName related ContactPerson will automatically in ContactPerson dropdown.
Now I change that customer name field to textbox and contact person field as dropdown. Now what i want is if i type and select the CustomerName in customername textox, the CustomerName related ContactPerson have to load automatically in contactperson dropdown.
My Model
Visitors View Model
public Nullable CustomerID { get; set; }
public string CustomerName { get; set; }
public Nullable CustomerContactID { get; set; }
public string ContactPerson { get; set; }
My View
@Html.LabelFor(model => Model.CustomerName, new { @class = "control-label" })
@Html.TextBoxFor(model => Model.CustomerName, new { @class = "form-control" })
@Html.HiddenFor(model => Model.CustomerID)
@Html.Label("Contact Person", new { @class = "control-label" })
@Html.DropDownListFor(model => model.CustomerContactID, new SelectList(string.Empty, "Value", "Text"), "Please select a ContactPerson", new { @class = "form-control", type = "text", id = "CustomerContactID" })
My above code is working if i type and select the customer name the customername relatedcontact person is loading in contact person dropdown but what my doubt is i gave blur function in contact person dropdown
$('#CustomerName').blur(function (){
I donno my code is correct or not however it is working. now what i want is any one tell me the alternate or correct code for this blur function. I tried to explain my issue as per my level best any one help me to resolve this issue..
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
I donno my code is correct or not however it is working. now what i want is any one tell me the alternate or correct code for this blur function.
I don't find any issue with in your code. Also it works fine. So no need to change the blur function. Since, it is a jquery based, mostly all the browsers are compatible with it. Is there any specific reason out there, to change the blur function? My suggestion is leave this functionality as is. :)
Francis SusaimichaelPosted Jun 16, 2016, 10:30 PM