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.
It is often needed to extend some of the capabilities of Sitefinity built in widgets. Since the widgets implementation is in Sitefinity assemblies the code files are not directly accessible. To override the methods for the widgets it is needed to inherit from the built in widget and override some of the methods. I will describe two approaches for doing so. One involves inheriting from the widget and creating new control with the modified logic. Another approach is to replace the built in widget with the modified one. The two approaches are interconnected.
1. Create a new class in the Sitefinity solution. Then must find out how to inherit one widget. For this example I will be inheriting Sitefinity login control.
2. To find the needed path that should be inherited (Telerik.Sitefinity.Web.UI.PublicControls.LoginControl) go to Administration->Settings->Advanced->Toolboxes->PageControls->Sections->Login->Tools->Login and find textbox: Control CLR Type or Virtual Path. In it you can take the path Telerik.Sitefinity.Web.UI.PublicControls.LoginControl as well as other properties that will not be needed fro this example.
3. In the .class file created in step 1 inherit from Login Control. The class should look like this.
Class1 : Telerik.Sitefinity.Web.UI.PublicControls.LoginControl
type override keyword to access a list of all methods that can be overridden. Make sure you are calling the base method when overriding to be sure the built in implementation for this method will also be included (base.LoginForm_Authenticate(sender, e);).
sender, System.Web.UI.WebControls.AuthenticateEventArgs e)
5. Now register new widget that will be the modified login control.
For more information, see Registering a new widget in Sitefinity.
Go to Administration->Settings->Advanced->Toolboxes->Toolboxes->PageControls->Sections->Login->Tools and click create new button in the main content area. Register the control with
Control CLR Type or Virtual Path: SitefinityWebApp.CustomizedLoginControl
The customized control is now available in page edit screen under the Login section and the control is called CustomizedLoginControl.
Note some of the built in widgets that have separate views like news, blogs, events have two views.
MasterListView this is the view that displays a list of all news, blogs, events items and sorts them.
DetailsView displays full contents of a single content item blog post, news item, event item.
Both views are using separate code file so the first approach with registering only one code file as a single control will not be of much use in this case. Refer to the second approach where you will be able to insert logic into a separate view (MasterListView or DetailsView).
Administration->Settings->Advanced->ContentView->Controls-> here a big node is expanded that list most of the backend controls. Go to NewsFrontend->Views and here you will see NewsFrontendList and NewsFrontendDetails. This naming is the same for all widgets that have two views (MasterList and Details).
To use different logic for NewsFrontendDetails click the menu item and find the textbox ViewType with content: Telerik.Sitefinity.Modules.News.Web.UI.DetailsSimpleView, this is the path from where the newsDetails code is taken and the path that we need to inherit.
Inherit Telerik.Sitefinity.Modules.News.Web.UI.DetailsSimpleView in the class file created at step one and you will be able to overwrite methods from DetailsView.
To use the new DetailsView register it in the same box ViewType.SitefintiyWebApp.CustomDetailsViewClass. (the full path to the class file, namespace.class of the newly created class file.
CustomNewsDetailsView : Telerik.Sitefinity.Modules.News.Web.UI.DetailsSimpleView
It is best you first test modifing the built in views on a test project first before making such modifications to the project.
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.