Click here to Skip to main content
15,909,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have html.partial in my html markup which is getting and displaying all the records from database. but i want to change it to selected records.. i mean i want to put where clause in html.partial.. is it possible to add where clause in partial and filter the records?
my html markup is like this
@Html.Partial("ListProductPartial", Model.Data.OrderByDescending(o => o.Id))

Thanks

What I have tried:

@Html.Partial("ListProductPartial", Model.Data.OrderByDescending(o => o.Id))
Posted
Updated 24-Aug-17 5:07am

1 solution

This has nothing to do with Html.Partial. It has everything to do with your query that is returning the data you're passing into the Model you're Partial is using.

You can do it by adding a Where clause to your Data query. Probably something like:
C#
... Model.Data.Where(conditional expression).OrderByDescending(o => o.Id))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900