Got stuck with an problem i hoping you can help me with.
I am using Visual Studio 2017 and have made an MVC Project that show tv-Channels I have a table in my database (full) that store all my data for my 5 channels, it look something like this:
Id Channel Program Date Time
1 One News 2018-11-11 18:00
2 One Sport 2018-11-11 20:00
3 Two Inception 2018-11-11 09:50
4 Three Seinfeldt 2018-11-11 11.00
5 Four Alf 2018-11-11 15:30
5 Four News 2018-11-11 19:00
.
.
.
This is my Controller
namespace Uppgift4.Controllers
{
public class FullsController : Controller
{
private TvProgramDBEntities db = new TvProgramDBEntities();
public ActionResult Index()
{
return View(db.Full);
}
This is My View
@model IEnumerable<Uppgift4.Models.Full>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<table class="table table-bordered table-hover">
<tr>
<th>
Channel
</th>
<th>
Program
</th>
<th>
Date
</th>
<th>
Time
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Channel)
</td>
<td>
@Html.DisplayFor(modelItem => item.Program)
</td>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.Time)
</td>
</tr>
}
This works fine and i get a list of all my programs in my view.
Now i want to filter this table, by adding 5 checkboxes(one for each channel), so i can choose which channel i want to show data from. So when i for example check One and two i just get the programs for this two channels in my view, How can i add this feature in my view?
Aucun commentaire:
Enregistrer un commentaire