أماني مفيد

أماني مفيد

  • NA
  • 142
  • 15.8k

pass value of drop down list from view to controller

Sep 28 2020 1:02 PM
i have this dropdpwn list  i want to pass the slected value from it to contoller 
@Html.DropDownListFor(model => model.Contant.KEYWORD_NAME, ViewData["KEYWORD_NAME"] as IEnumerable<SelectListItem>, "Select Company Name", new { @class = "form-control" })

i use this way to pass value from view to contoller 
@if (Model != null)
{
@Html.PagedListPager(Model.Items,page => Url.Action("search", new { page, search = Request.QueryString["search"] , KEYWORD = ViewData["KEYWORD_NAME"].ToString()}),
new PagedListRenderOptions()
{
Display = PagedListDisplayMode.IfNeeded,
DisplayPageCountAndCurrentLocation = true
,
DisplayItemSliceAndTotal = true
})
}
 
but in the contoller 
public ActionResult search(int? page, string search, String KEYWORD)
 the value of  KEYWORD set to be "NULL " 
in the  URL broswer the KEYWORD vlue not null 

Answers (3)