أماني مفيد

أماني مفيد

  • 1.9k
  • 40
  • 1.1k

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 

Brought to you by:

Answers (3)