ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Grid initial sort
Title:
B
I
{code}
?
Started to play around the Grid :) To get items displayed in grid I use (like in the demo) following line: var items = db.MyClass.Where(o => o.Field1.ToLower().Contains(search)).AsQueryable(); I want to display items in specific order (after initializing the grid), so i thought somethig like this would work var items = db.MyClass.Where(o => o.Field1.ToLower().Contains(search)).AsQueryable().OrderBy(o => o.Id); But the sort order is always descending by Id. Any hint?
Save Changes
Cancel
TT Tom
asked at 14 Nov 2015
Answers
B
I
{code}
?
the items are ordered by the key, by default desc, but you can change that: var model = new GridModelBuilder<Chef>(data.AsQueryable(), g) { Key = "Id", DefaultKeySort = Sort.Asc }.Build();
Save Changes
Cancel
Omu
answered at 14 Nov 2015
A W E S O M E :)
at 14 Nov 2015
TT Tom
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK