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.
For this example I will be using Sitefinity 3.7 because it already provides some ready scripts that help us get the selected item IDs and pass them to the web service. The use of the bellow sample is also achievable in older versions of Sitefinity, however there you will need to add new button to the grid containing content items and then subscribe to its click event.
Now lets start by creating a regular web service in your Sitefinity website. I have created one in the ~/Sitefinity/Services folder and named the file CustomContentService.asmx. When you create a web service VS automatically generates the code file in your ~/App_Code directory. Bellow is the sample code that we will use to create copies of content items:
What we need to do now is to register the newly created web service to the script manager, so that we can use its methods. You can do this in the OnPreRender event handler of the ~/Sitefinity/Admin/Modules.aspx.cs:
Next we need to add some markup and JS to the control templates for displaying content items in the modules where we need this service. For this you will need to work with the external templates for your version of Sitefinity. Here I will sample how to do this with the Generic Content module. Open the ~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentItemsList.ascx. First add a link button to the div that holds group operations commands:
Then add some JS to be make the button look and behave as the rest of the commands:
Then add a java script function that will handle the on client click event of the duplicate button that we have just added. This function will make the call to our web service passing the selected item IDs:
All you have to do now is to map the control template in your ControlsConfig file and restart the website:
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.