I have a HTML code
<div>
<h2>Books</h2>
<div class="pull-right">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
Filter By:
</button>
<ul class="dropdown-menu">
<li><a href="#">All Books</a></li>
<li><a href="#">Computer Science </a></li>
<li><a href="#">Physics</a></li>
<li><a href="#">History</a></li>
<li><a href="#">Geography</a></li>
<li><a href="#">Fiction</a></li>
</ul>
</div>
</div>
<table cellpadding="5">
<tr>
<th>Title</th>
<th>Author</th>
<th>Catagory</th>
</tr>
@foreach (var b in new BookRepository().GetAll().ToList())
{
<tr>
<td>@b.Title</td><td>@b.Author</td><td>@b.Category</td>
</tr>
}
</table>
</div>
and the code of book repository it is pulling from is
public BookRepository()
{
_data = new List<Book>
{
new Book
{
Id = 1,
Title = "Computer Science For Dummies",
Author = "Joe Bloggs",
Category = BookCategory.ComputerScience
},
new Book
{
Id = 2,
Title = "Computer Science For Experts",
Author = "Jane Doe",
Category = BookCategory.ComputerScience
},
new Book
{
Id = 3,
Title = "Introduction to Black Holes",
Author = "Stephen Hawking",
Category = BookCategory.Physics
},
new Book
{
Id = 4,
Title = "World War 1",
Author = "James Martin",
Category = BookCategory.History
},
new Book
{
Id = 5,
Title = "World War 2",
Author = "James Martin",
Category = BookCategory.History
},
new Book
{
Id = 6,
Title = "Teary Operators And When Not To Use Them",
Author = "Ae Potter",
Category = BookCategory.ComputerScience
},
new Book
{
Id = 7,
Title = "Geography Rocks!",
Author = "Martin Prince",
Category = BookCategory.Geography
}
};
}
the question i have is i want to filter the data in the repository using drop down in the HTML without refreshing the page
please help me do it
