Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

ASP.NET Filtering

I am trying to finish this project where the user can select a color from a dropdown list and then press the filter button. Once they press the filter button the view changes so the page refreshes and only shows pictures with those colors. I need to do this by finding the matching color ID from the database to the user-selected color from the dropdown menu.


Here is the dropdown menu I am using

[Image: Xg0CUCg.png]


Here is my code I have so far that does not work. When I hit the filter button the page refreshes but it is exactly the same and shows all the same pictures as before instead of just one color. I think I am either missing something or going wrong in my query to the database. the variable uColor is set up to get the user selection from the dropdown menu.

[Image: qb6iU1A.png]

Any help would be appreciated.
[Image: jake-johnson-hf-sig.png]
(Oct 27, 2020 01:48 PM)Jake Johnson Wrote:  I am trying to finish this project where the user can select a color from a dropdown list and then press the filter button. Once they press the filter button the view changes so the page refreshes and only shows pictures with those colors. I need to do this by finding the matching color ID from the database to the user-selected color from the dropdown menu.


Here is the dropdown menu I am using

[Image: Xg0CUCg.png]


Here is my code I have so far that does not work. When I hit the filter button the page refreshes but it is exactly the same and shows all the same pictures as before instead of just one color. I think I am either missing something or going wrong in my query to the database. the variable uColor is set up to get the user selection from the dropdown menu.

[Image: qb6iU1A.png]

Any help would be appreciated.

This can be overcome in several ways very simple,in your controller you have POST and GET action unless you use one action for post and get which, as far as I can see, is not the case here.
So for your simple solution would be to set ViewBag or ViewData on post and then in get check if there are any criteria which should be respected if it really exists and if there is no criteria display standard output on get.
buy me a coffee eth:0x88621A52aa5Eb3b6503628369687111810186c58


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by iconv32Jul 10, 2022 12:18 PM 0 213 Jul 10, 2022 12:18 PM
Last Post: iconv32
[C#] by Jake JohnsonDec 10, 2020 09:25 AM 3 302 Dec 10, 2020 09:25 AM
Last Post: Xamarin
[C#] by EXPLICIT CONTENTOct 20, 2019 08:16 AM 3 225 Oct 20, 2019 08:16 AM
Last Post: +Haze