1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / RadGrid with SEO Enabled in Widget

RadGrid with SEO Enabled in Widget

3 posts, 0 answered
  1. vitako
    vitako avatar
    22 posts
    Registered:
    28 Feb 2010
    28 Nov 2012
    Link to this post
    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:
    • UseRouting - notifies RadGrid that routing is enabled for the ASP.NET application.
    • SEORouteName - specifies the name of the current route that is used. If the value is empty, the first route with matching route data is used.
    • SEOPageIndexRouteParameterName - specifies the URL parameter that is used to get the page index from the URL. Empty value indicates the SEOPagingQueryStringKey value will be used.

    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:  http://www.telerik.com/help/aspnet-ajax/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.

  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    30 Nov 2012
    Link to this post

    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
        }
    }


    However I'm unsure if you should be using the RouteTableRoutes or the Sitefinity specific RouteManager.RegisterRoute, since this one doesn't expose the same methods for routing.. let me find out more and get back to you.
  3. vitako
    vitako avatar
    22 posts
    Registered:
    28 Feb 2010
    01 Dec 2012
    Link to this post
    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.

3 posts, 0 answered