Filtering via URL

Posted by Community Admin on 04-Aug-2018 03:14

Filtering via URL

All Replies

Posted by Community Admin on 10-May-2012 00:00

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

Posted by Community Admin on 10-May-2012 00:00

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!

This thread is closed