More in this section

Forums / Developing with Sitefinity / Filtering via URL

Filtering via URL

2 posts, 0 answered
  1. Jason
    Jason avatar
    16 posts
    Registered:
    27 Aug 2008
    10 May 2012
    Link to this post
    Hi All,

    I'm looking to create a custom module and then filter the list view based on the URL.  For example:

    http://myurl/programs - would list all programs
    http://myurl/programs/NH - all program within NH

    I've been looking through the documentation and haven't quite been able to get a handle on how to accomplish this.  Any pointers?  

    Thanks,
    Jason
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    10 May 2012
    Link to this post
    Jason, Sitefinity routing converts requests like this into parameters in the RouteData.Values property of the Request. You can absolutely retrieve these from your controls to get specific items based on these parameters.

    Take a look at this post that explains how you might do this: http://www.sitefinity.com/devnet/forums/preview-thread/sitefinity-4-x/general-discussions/how-do-i-construct-a-dynamic-page-url-in-sitefinity.aspx

    This is the same procedure used for the Intrasite Testimonials Module example from the Sitefinity SDK.

    Another key element is the method:

    RouteHelper.SetUrlParametersResolved();

    which tells the response not to return 404, but instead continue executing the code on your control. Call this when you find the elements based on the input parameters.

    I hope this is helpful!
2 posts, 0 answered