RadControls for ASP .NET AJAX version
2010.1.415 and later
3.5 and later
|Visual Studio version
2008 and later
all browsers supported by RadControls for ASP .NET AJAX
This project demonstrates an implementation of SEO-friendly sorting
for RadGrid, similar to the RadGrid SEO Paging functionality
. SEO sorting allows search-engine crawlers to index sorted grid items by requesting them through unique URLs. Users can also use the URL for bookmarking particular sorted states of the grid. SEO sorting is implemented by the GridSEOSortPersister
class and, to be able to use it, you just need to create an instance of the class specifying the RadGrid instance in the constructor. This must be done before RadGrid initializes its items and databinds. In the context of a page life cycle, Page_Init
is a good candidate to use for that.
Implementing SEO sorting for RadGrid involves 2 main tasks:
- Parsing any sort query strings in RadGrid's DataBinding event and building corresponding sort expressions. In this phase, any valid sort query string passed in the URL is converted to a GridSortExpression. Doing this in DataBinding event ensures RadGrid will actually apply the SEO sort right after.
- Replacing the header sort buttons in RadGrid's ItemCreated event. RadGrid's default sort buttons make a page postback and are not suitable for SEO sorting. We need to replace the existing buttons with Hyperlinks that link to the same URL, but contain appropriate sort query strings. In this way, every sort combination is represented by a query string.
SEO-friendly sorting is compatible with RadGrid's built-in SEO-friendly paging functionality.