Deliver superior customer experiences with an AI-driven platform for creating and deploying cognitive chatbots
Deliver Awesome UI with the most complete toolboxes for .NET, Web and Mobile development
Automate UI, load and performance testing for web, desktop and mobile
A complete cloud platform for an app or your entire digital business
Detect and predict anomalies by automating machine learning to achieve higher asset uptime and maximized yield
Automate decision processes with a no-code business rules engine
Optimize data integration with high-performance connectivity
Connect to any cloud or on-premises data source using a standard interface
Build engaging multi-channel web and digital experiences with intuitive web content management
Personalize and optimize the customer experience across digital touchpoints
Build, protect and deploy apps across any platform and mobile device
Rapidly develop, manage and deploy business apps, delivered as SaaS in the cloud
The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
The main reason of this post is a discussion that I had in Sitefinity's forum post. So, the problem here is that you have BlogPosts control that supports filtering, but the same does not apply for CategoriesTree control. Using BlogPosts FilterExpression property you can show only a specific blog posts or group of blog posts instead of all blogs and posts from your provider. So far so good. The main problem comes here. When you drop CategoriesTree built-in control on a page and set ProviderName property, the CategoriesTree control is bound to all categories for this provider instead of categories related to your filtered list of blogs only. I managed to come up with a simple solution that requires creating a custom control that derives from CategoriesTree, implementing a simple property and overriding one method - BindCategories.
1. The property - I will implement a simple property of type Guid which will be used to return the ID of selected blogs. These blogs should be the same as those one listed in BlogPosts control
2. Override LayoutTemplatePath property - we will "map" the external template for CategoriesTree which will allow to make some modifications in RadTreeView declaration.
3. Override BindCategories() method.
- here I check whether there is a value set for our property SelectedBlog. If there is no value I call the base and do not change anything. If there is a value set, I proceed with our custom logic.
- Get the blogs by IDs.
- Get all posts from our blogs
- get metadata - Category for IContent object
- create a new generic list of type ICategory
- add all matches to this list
- bind RadTreeView control to our custom list
- subscribe for NodeDataBound of RadTreeView control to set the node.NavigateUrl property.
The full code is shown below:
View all posts from The Progress Guys on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.