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

Last Reply on Apr 05, 2018 12:07 AM By Mudassar

Posted on Apr 04, 2018 05:15 AM

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.