Pass Selected DropDownList Value to Controller in ASP.Net MVC

Last Reply 9 months ago By GuruLogu

Posted 9 months ago

Code Behind in View Page

<div class="form-group col-md-6">
  @Html.LabelFor(model => model._packagetype_, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
   @Html.DropDownListFor(model => model._packagetype_, Model.PackageTypeList_.Select(m => new SelectListItem { Text = m.Package, Value = Convert.ToString(m.Package_id) }), "Select", new { @class = "select-select2", style = "width: 100%;" })

 Code behind in Controller

 var _packagetype = Request.Form["_packagetype_"].ToString();

Here i'm getting integer value of  _packagetype is 1,2... but i need a string inside the textbox


I agree, here is the link: