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

Pass ViewData to select TagHelper ? How ?

$
0
0

Hi , im trying to put a drop-down list to work on asp.net 5 with no luck, maybe someone can help.

Thanks In advance

Here's the code:

Controller Code:

        // GET: WorkingDays/Create
        public IActionResult Create()
        {
            ViewData["LocationID"] = new SelectList(_context.Location, "LocationID", "Location");
            ViewData["VehicleID"] = new SelectList(_context.Vehicle, "VehicleID", "Vehicle");
            ViewData["WorkerID"] = new SelectList(_context.Worker, "WorkerID", "Worker");
            return View();
        }

View Code:

        <div class="form-group">
            <label asp-for="Location" class="col-md-2 control-label"></label>
            <div class="col-md-10">
                <select asp-for="Location" asp-items="?????" class="form-control" ></select>
            </div>
        </div>


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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