Try Now
More in this section

Forums / Project Feather / Optional UrlParameters in custom feather widget

Optional UrlParameters in custom feather widget

1 posts, 0 answered
  1. Stacey
    Stacey avatar
    291 posts
    18 Oct 2012
    28 Mar
    Link to this post

    I have a custom feather widget that I am using to show Master/Detail views for Sitefinity's Ecommerce content type.  Now I need to figure out a way to also allow filtering by a few different scenarios.  I may either have a classificaiton or I may have a Sitefinity product type coming as a parameter.  I had planned to put some logic in to handle them respectively, but I just cannot figure out how to do this with auto-routing.

           public ActionResult Index()
               ViewBag.CurrentPageUrl = this.GetCurrentPageUrl();
               return View("Default");
    public ActionResult Details(Product productItem)
               var viewModel = service.CreateProductDetailsViewModel(productItem);
               return View(viewModel);

    I have tried adding a ListByTaxon action, but it never seems to get hit.  I instead get a 404.

    public ActionResult ListByTaxon(ITaxon taxonFilter, int? page)
               string fieldName;
               if (taxonFilter.Taxonomy.Name == "Categories")
                   fieldName = taxonFilter.Taxonomy.TaxonName;
                   fieldName = taxonFilter.Taxonomy.Name;
               ViewBag.WindowTypeName = fieldName;
               return View("Default");


    I have tried adding a custom action with RelativeRoute, but that destroys the ability to use the built-in auto-routing for master/detail.

    Another thought I had was to put in HandleUknownAction, but I am only pulling one parameter back when I am passing two.  I am guessing that is due to the actions only taking 1.

    protected override void HandleUnknownAction(string actionName)
                var urlParameters = this.ControllerContext.RouteData.Values["action"];
                if (urlParameters != null && urlParameters.Any())
                    if (urlParameters[0] == "custom-type")
                        this.Response.StatusCode = (int)HttpStatusCode.OK;
                        ViewBag.CustomTypeName = urlParameters[1];


    The conditions I am looking to allow are:

    page/products/ (master view)

    page/products/info (details view)

    page/products/type/producttype (custom product type via Sitefinity Ecommerce)

    page/products/application/classification (this would be custom classifications)


1 posts, 0 answered