How create part with paging?

Topics: Writing modules
Jun 27, 2013 at 11:51 AM
Edited Jun 27, 2013 at 11:51 AM
I create Custom Part.
Add Custom Part and Autoroute Part to Custom Type.

I whould like to use paging in my custom part.
I create Custom Handler,
OnGetContentItemMetadata<ManufacturerPart>((context, part) => {
                context.Metadata.DisplayRouteValues = new RouteValueDictionary {
                    {"Area", "Opt.Commerce"},
                    {"Controller", "Manufacturer"},
                    {"Action", "Display"},
                    {"id", context.ContentItem.Id}
                };
            });
But now Html.ItemDisplayLink return me not autoroute part alias value.
How i can fix it?
Developer
Jun 30, 2013 at 3:15 PM
Since you're custom-rendering your content item via the Manufacturer controller, you can access the AutoroutePart of the specified content item, and its properties.
Developer
Jun 30, 2013 at 3:16 PM
Or did you mean you want the alias to be rendered as the url, which is mapped to your DisplayRouteValues?
Jun 30, 2013 at 3:45 PM
Yes i mean the alias to be rendered as the url, which is mapped to your DisplayRouteValues.
Like Orchard Container Part.
Developer
Jun 30, 2013 at 4:09 PM
That should just work: when you create a content item which has a ManufacturerPart attached and publish that content, AutorouteService.PublishAlias will link your DisplayRouteValues with the generated alias. If not, please attach the debugger to see what's going on.
Jul 3, 2013 at 9:48 PM
The problem was that the route values ​​are stored in the database and overwritten only after saving content item.
After saving it worked.