---
title: "webgrid sorting not working"  
description: "webgrid sorting not working"  
author: "Manish Kumar"  
published: 2017-11-08  
updated: 2017-11-10  
canonical: https://www.mindstick.com/forum/34360/webgrid-sorting-not-working  
category: "asp.net"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# webgrid sorting not working

[webgrid](https://www.mindstick.com/forum/34092/how-to-implement-a-webgrid-in-asp-dot-net-mvc) [sorting](https://www.mindstick.com/articles/1581/sorting-list-with-side-bar) not working

I'm using webgrid to show [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) from my data base. i want to show [date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner) wise record.

here is my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)

```
@{
    var grid = new WebGrid(Model, canSort: true, canPage: true, rowsPerPage: 50, sortFieldName: "Active", default:"PostedDate"  ajaxUpdateContainerId: "updategrid");
}
```

## Replies

### Reply by Sunil Singh

You can try this

```
@{
    var grid = new WebGrid(Model.OrderByDescending(x=>x.PostedDate), canSort: true, canPage: true, rowsPerPage: 50, sortFieldName: "Active",  ajaxUpdateContainerId: "updategrid");
}
```


---

Original Source: https://www.mindstick.com/forum/34360/webgrid-sorting-not-working

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
