Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

filtering

$
0
0

i wanna filter Categoria in controller Index passing to view index

 // GET: Submissions
        public async Task<IActionResult> Index(int categoria)
        {
            var designContext = _context.Submissions.Include(s => s.CategorieNavigation);
            ViewData["Categoria"] = new SelectList(_context.Categories, "IdCategoria", "Categoria");
          
            return View(await designContext.ToListAsync());
        }

<form asp-action="Index" method="get">
    

    <select asp-for="@ViewData["Categoria"]" asp-items="(SelectList)@ViewData["Categoria"]"></select>  <-------error here
    <input type="submit" value="Filter" class="btn btn-default" />
               
</form>

the problem is that the dropdown is orphan

any sugestions?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>