I want to send value of my dropdownlist

     @Html.DropDownListFor(model => model.selection, Model.liste_selection, new {@id="Selection", @class = "form-control" })

with this ajax post

<script>
$('#valider').on("click",function () {


    $.ajax({
        url: '@Url.Action("Executer", "Requete")',
        type: "POST",
        data: { id: $('#Selection').val() },
        success: function (result) {
            $('#ajaxDisplay').html(result);
        }
    });

});

But the value of my dropdown list doenst reach controller it goes null

Here is my controller

   [HttpPost]
    public ActionResult Executer(RequeteOptimise ro, string Command)
    {

        Session["dateDebutReq"] = ro.begin.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
        Session["dateFinReq"] = ro.end.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
        if (ro.selection.Contains("Tous"))
        {
            var viewModel = new RequeteOptimise
            {
                nombre = rr.callReqCount(ro)
            };

            return PartialView("../utilities/Nombre", viewModel);
        }

Related posts

Recent Viewed