TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
John Vicencio
NA
73
1.2k
Adding Search Filter and View of Enum
Aug 20 2017 1:41 PM
I'm trying to follow this tutorial https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/adding-search
My model has an enum of category of items. What I'm trying to do is:
1. Assuming there's a "model" class with properties (id, name, category in Enum)
2. Create a LINQ query of List collection and assign to ViewBag
3. So that this list is shown on DropDownList (in view) @Html.DropDownList("Category", "All)
4. If you select, "All", all items should be shown as you first load the page
5. If not, then show all the items under that category
6. Making sure that the drop down shown "distinct" (as per the link above)
Problem:
1. Everything works but on first load of the page when you compile, the drop down on the view shows "All" as the first option. It should have shown all items with their category
2. However the items show up upon selecting the actual categories
Advise.
Reply
Answers (
2
)
Query in creating equal gaps between 4 buttons
Getting Large negative value in Auto Increment column