I have an ASP.NET chart control that will show the estimated time vs time spent by each student on each class activity. I would like to have a dropdownlist control to filter the chart by the activity status; All, Open, Closed. I already populated the chart control and dropdownlist control with the data from the database. However, I am struggling now with modifying my query in order to filter the chart based on the selection in the dropdownlist.
The chart should display all the activities at the beginning (by default). Then, when the user selects a status from the dropdownlist, then the chart will be filtered based on the selection
So how can I modify my query to include this optional filtration?
DB schema:
Task Table: TaskId, Title, EstimatedTime, StatusId
Entry Table: EntryId, TaskId
EntryDetails Table: EntryDetailsId, EntryId, Hours
Status Table: StatusId, Name
Here's my query:
SELECT tbl_Task.Title AS [Task Title], tbl_Task.EstimatedTime AS [Estimated Time], SUM(tbl_EntryDetails.Hours) AS [Time Spent]
FROM tbl_EntryDetails INNER JOIN
tbl_Entry ON tbl_EntryDetails.EntryId = tbl_Entry.EntryId RIGHT OUTER JOIN
tbl_Task ON tbl_Entry.TaskId = tbl_Task.TaskId
GROUP BY tbl_Task.Title, tbl_Task.EstimatedTime