how to take value from an autocomplete and send to the controller (AJAX)

Asked

Viewed 65 times

0

You can receive the chosen value from a field and use this value in a variable in the controller?

This is my field:

<div class="form-group  hidden" id="idnome" > 
    <label>NOME </label>
    <div class="qlyAutoComplete">
        @Html.TextBox("NOME", null, new { @class = "form-control AutoCompletar", 
        maxlength = 50, urlAC = "/RecursosHumanos/PopularPessoa", hidAc = "" })

        @Html.ValidationMessage("NOME", new { @class = "CorVermelhoNegativo" })
    </div>
</div>

1 answer

0

If the above code is inside a Form and this form is submitted to the controller, just in the action you want to receive this value have a parameter called Name.

Look at a simple example

Public ActionResult Test(string Nome)
{ Return View(); }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.