mardi 4 avril 2017

Display Values based on dropdown selection MVC

I have a requirement which I need to display details based on drop down selection. These details coming from database. when I click one user all then all the details belong to that user has to be displayed. This is my Model, public class TaskDetails { public string ProjectID { get; set; } public string ProjectName { get; set; } public DateTime StartDate { get; set; } public DateTime EstimatedDate { get; set; } public string TaskDescription { get; set; } }

This is My Controller,
            List<SelectListItem> query = DE.tblEmployees.Select(c => new SelectListItem { Text = c.Name, Value = c.Name }).ToList();
            ViewBag.Categories = query;
            return View();

This is My View,
<div class="dropdown">
        @Html.DropDownList("CategoryID", (List<SelectListItem>)ViewBag.Categories, "--User Name--")

In the View I am loading all the user values inside the drop down. But when admin selects any of the user then all the details of user has to be displayed under a table. Upto here I am perfect but from here got strucked. How to move forward how to show the details of the user based on dropdown selection.

Aucun commentaire:

Enregistrer un commentaire