Get selected value of DropDownList in Controller in ASP.Net MVC

Last Reply one year ago By Mudassar

Posted one year ago

i want to insert data in database using store procedure in mvc with dropdown(which is bind from database ). and i will insert that form in database using storeprocedure.

        [HttpGet]
        public ActionResult Create()
        {
            CityContext c = new CityContext();
            ViewBag.CityMast = new SelectList(c.CityMasts, "CityId", "CityName");
 
            return View();
        }

 

@Html.DropDownList("CityMast","Please Select")

i want to get this dropdown value and insert in database.