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.
If you want to allow your editors to edit some already published content without having them go to Sitefinity backend and edit widget or content item you can use Sitefinity built in Browse and Edit functionality.
Here I will describe how to implement it in your custom widgets or modules.
To use this functionality you need to implement IBrowseAndEditable interface.
1. In your widget code file or your module code file that manages the correct frontend view(MasterView or DetailsView) implement IBrowseAndEditable
public
class
ProductDetailsView : ViewBase, IBrowseAndEditable
Add the interace implementation
//Adds browse and edit commands to be executed by the toolbar
void
AddCommands(IList<BrowseAndEditCommand> commands)
{
this
.commands.AddRange(commands);
}
// Represents the browse and edit toolbar for the control
BrowseAndEditToolbar BrowseAndEditToolbar
get
if
(
.browseAndEditToolbar ==
null
)
.browseAndEditToolbar =
.Container.GetControl<BrowseAndEditToolbar>(
"browseAndEditToolbar"
,
true
);
return
.browseAndEditToolbar;
BrowseAndEditToolbar IBrowseAndEditable.BrowseAndEditToolbar
.BrowseAndEditToolbar;
//Gets the information needed to configure this instance.
[PersistenceMode(PersistenceMode.InnerProperty)]
BrowseAndEditableInfo BrowseAndEditableInfo
;
set
private
BrowseAndEditToolbar browseAndEditToolbar;
List<BrowseAndEditCommand> commands =
new
List<BrowseAndEditCommand>();
In InitializeControls method add
(SystemManager.IsBrowseAndEditMode)
.SetDefaultBrowseAndEditCommands();
.BrowseAndEditToolbar.Commands.AddRange(
.commands);
var bem = BrowseAndEditManager.GetCurrent(
.Page);
(bem !=
bem.Add(
.BrowseAndEditToolbar);
The last step is to add BrowseAndEdit toolbar control to your template
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<
sf:BrowseAndEditToolbar
ID
=
runat
"server"
Mode
"Edit"
></
>
When you activate browse and edit functionality on the frontend of your site you will see the edit button where your widget is placed and editing it will take you to the widget designer or module item edit view.
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Copyright © 2019 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.