I have a method that is responsible for loading the options from a drop-down menu.
When this view loads for the first time the method receives a null parameter, therefore it does not try to load any option in the drop-down menu
Now when the user finishes typing a number a field that is a html helper TextboxFor and exits this control the method is triggered again.
Only this time the method receives as a parameter the value that the user entered.
Now when he receives this parameter now if the method will bring a list of records.
And assign this list to a property of the model and then pass it on view.
However, and this is the problem, it happens that I cannot make the model update the drop-down menu with the list that is being sent to the property
I have already used ajax but by politas of the company I am not allowed to make a request to a WebService using the local host which busts me the application.
I also tried to make an append of JQUERY and it didn't work.
Try to reload the page but he deletes all other values that the user has previously typed.
This is the function that is responsible for calling the method that will bring the list of options that I need to load from the drop-down menu
$("#DdlDocType").empty();
var a=document.getElementById('CodTranportista').value;
$.get("/Documents/Add",{codtransport:a}, null);
PD. CodTransportista is the Id of the TextBox from which I am getting the value that I will pass to the method.
codtransport is the name of the variable that received the method in the code behind.
DdlDocType is the id I have assigned to the HTML Helper DropDownListFor
And this is DropDownListFor Html Helper that received the model
@Html.DropDownListFor(model => model.CarrierdtId, Model.SelectDocTypes, "No selection", new { id = "DdlDocType", @class = "col-xs-6 col-sm-4 col-md-6 col-lg-4 selectpicker show-menu-arrow modal-input" })