Hi I have registered route as below :-
routes.MapLocalizedRoute("Category",
"{SeName}-c{categoryId}",
new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional },
new { categoryId = @"\d+", SeName = @"([-\w+]+(/[-\w+]+)*)+" },
new[] { "Nop.Web.Controllers" });
routes.MapLocalizedRoute("CategoryWithManufacture",
"{SeName}-d{categoryId}/{ManufactureName}/{Color}",
new { controller = "Catalog", action = "Category", SeName = UrlParameter.Optional, Color = UrlParameter.Optional },
new { categoryId = @"\d+", SeName = @"([-\w+]+(/[-\w+]+)*)+", ManufactureName = @"([-\w+]+(/[-\w+]+)*)+", Color = @"([-\w+]+(/[-\w+]+)*)+" },
new[] { "Nop.Web.Controllers" });
We generate these like below :-
href="@Url.RouteUrl("CategoryWithManufacture", new { categoryId = currentCategoryId, SeName = seName, ManufactureName = manufacturerFilterItem.Name, Color = color })"
href="@Url.RouteUrl("Category", new { categoryId = currentCategoryId, SeName = seName})"
There is a way to assign value directly to second parameter "Color" without assign value to "ManufactureName". means :- (Using CategoryWithManufacture Route)
/gloves-d18/red (second parameter)
/gloves-d18/hp/red (first and second both)
I have tried these by making manufactureName & color both optional but when we assign value to first parameter not second it , it work . But we assign value to second parameter not first ,then it is not work .
Please suggest me usable link or sample code.