Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
أماني مفيد
1.9k
79
2.5k
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
Reply
Answers (
3
)
bind a viewdata inside dropdown list
Calling function in external js file from html hyperlink