RadGrid with SEO Enabled in Widget
Hi Everyone,
I created the widget and placed SEO Enabled RadGrid in this widget.
The widget was registered in sitefinity backend and placed on the page.
So far it works good.
But if possible the only one change is required.
When you navigate from page to page it shows the urls in the following format:
http://mydomain.com/classifieds/ads?ctl00_cphMain_C001_gvAdsChangePage=2_3
(value 2_3 in this case means page 2, show 3 records per page)
We would like to have routed urls in the following format:
Routed URL: http://mydomain.com/classifieds/ads/page/2
or
Routed URL: http://mydomain.com/classifieds/ads/page/2_3
After looking in RadGrid documentation we found the following information:
To enable routing support for the SEO pager, RadGrid introduces 3 new properties in RadGrid.PagerStyle:
To use URL routing with RadGrid, your application must specify a route to the .aspx page and that route should define a URL parameter specifying the grid page:
Here is the link to documentation page: www.telerik.com/.../grid-seo-paging.html
Unfortunately it didn work.
We tried to register route in global.asax file
protected void Application_Start(object sender, EventArgs e)
RegisterRoutes(RouteTable.Routes);
private void RegisterRoutes(RouteCollection routes)
routes.MapPageRoute(
"ClassifiedsPaging",
"page/pageNumber",
"~/classifieds/ads/",
true,
new RouteValueDictionary "pageNumber", "1" );
And here is PagerStyle settings for RadGrid
<PagerStyle Mode="NextPrevAndNumeric" EnableSEOPaging="true" UseRouting="true" SEORouteName="ClassifiedsPaging" SEOPageIndexRouteParameterName="pageNumber"></PagerStyle>
but received the following error:
route named 'ClassifiedsPaging' could not be found in the route collection.
As far as we know the routing is handled internally by sitefinity.
Does anybody knows if its possible to have Routed Urls for RadGrid in a widget??
Thanks.
You are correct that Sitefinity handles setting up the routing, but this is done internally with the Bootstrapper. You should be able to hook into it with something like this:
protected
void
Application_Start(
object
sender, EventArgs e)
Bootstrapper.Initializing +=
new
EventHandler<Telerik.Sitefinity.Data.ExecutingEventArgs>(Bootstrapper_Initializing);
void
Bootstrapper_Initializing(
object
sender, Telerik.Sitefinity.Data.ExecutingEventArgs e)
if
(e.CommandName ==
"RegisterRoutes"
)
// register routes here
Yes this is excactly what I am looking for.
I am not familiar with Bootstrapper and will investigate it over the weekend.
The goal is to use the built in functionality of RadGrid to display nicely Routed URLs for paging.
Of course we understand that is is not crucial for searh engines indexing. However we think it is very important for the end users to have friendly urls.
I will try to use your solution over the weekend.
Thanks.
Vitalii.