lundi 4 avril 2016

how to pass dropdownlist selected value to controller

binding of dropdownlist is as foolows

@Html.DropDownListFor(model => model.vDeptCode, (SelectList)ViewBag.deptList, "- Select Department -", new { @class = "form-control", @id = "ddl_Dept" })

On the same view i Have add button also after clicking on add button i have to pass deptCode value to my Action for that i have done

function CreateNewVoucher() {

         window.location.href = "@Url.Action("Add", "Voucher", new { @vDeptCode =@Html.Raw(Model.vDeptCode) })";

but it always pass null value. Please guide me how to pass value to my ActionResult

Aucun commentaire:

Enregistrer un commentaire