I have page which display a table and a DropDownList - which are not included in the form. When a user selects a value in the DropDownList - JavaSript puts the selected value in a text box named selectedCategory which is located in a form:
@Html.TextBox("selectedCategory", null, new { @id = "selectedCategory", @style = "width: 100px;" })
I am using paging, so I have:
@Html.PagedListPager(Model, page => Url.Action("Index",
new { page, SortO = ViewBag.SortO,
FilterV = ViewBag.FilterV,
category = selectedCategory }))
In this case I am getting error: The name 'selectedCategory' does not exist in the current context. When I run without "category = selectedCategory " on the page source I see the field exists:
<input id="selectedCategory" name="selectedCategory" style="width: 100px;" type="text" value="" />
So my question is how to add "category = value of selectedCategory field" ?
Thanks,
zb