Return select Asp.net core MVC value

Asked

Viewed 85 times

0

Good Morning,

I have a question, I have an application in Asp.net core. When selecting a Dropdownlist I want to receive this value without pressing the Ubmit button, but I don’t know how to do it, someone could give me a Light?

        <text>Nome Cliente: </text> @Html.DropDownList("IdCliente", new SelectList(ViewBag.ListaClientes, "IdCliente", "NomeCliente"), "--SELECT--", new { @id = "myForm", @class = "myclass" })

My Viewbag in the controller.

            //VIEW BAG PRA MOSTRAR OS CLIENTES
        ViewBag.ListaClientes = _context.Cliente.Select(
            a => new { a.IdCliente, a.NomeCliente }).ToList();

I need to receive this Idclient to make another select to show the Projects, but I can’t return the Id without sending the request, I wanted something in real time. Someone can help me?

  • make a call ajax, that can be fired in the event change dropdown

  • To add to what I said @Ricardopunctual sees my response in this question.

No answers

Browser other questions tagged

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