我认为此表格会导致我在控制器中执行某些操作。问题是我不知道如何将参数传递给action方法。
<form class="full-search" asp-controller="Movies" asp-action="Search">
<input type="search" name="searchmovie" placeholder="Search..." class="search-form">
<select name="option" form="">
<option name="option" value="category1">category 1</option>
<option name="option" value="category2">category 2</option>
<option name="option" value="category3">category 3</option>
</select>
<i class="fas fa-caret-down"></i>
<input type="submit" name="" class="submit-full-search">
<div class="search-btn-submit">
<img src="~/img/search.svg">
</div>
</form>
这是我的控制器:
[HttpGet("searchmoview/{option?}/{searchmovie}")]
public IActionResult Search(string option, string searchmovie)
{
//perform some search based on the filters
return View("Search", data);
}
但是当我运行我的代码时,当我单击搜索时,URL看起来像这样:
https://localhost:33590/Information/Search
而不是像这样:
https://localhost:44320/seachmovie/category1/{searchString}
关于如何传递参数的任何想法吗?
慕尼黑5688855
相关分类