Upgrading Custom App Blocks for V7
Author:Amanda A
Last Updated:August 31, 2021 11:36 AM
V7 App Block Upgrade Scenarios
ASCX Control App Block – Example: Gehl’s Distributor Locator
Old Components
- ASCX control
- Custom web service
New Components
- App block class:
- DistributorLocator
- Handles initial rendering
- Razor view:
- DistributorLocator.cshtml
- View model:
- DistributorLocatorViewModel class
- Ajax support controller:
- DistributorAjax.cs
- Handles server calls i.e. GetDistributor, GetResults
- Calls return view
- Display JavaScript:
- DistributorLocator.js
- Handles UI changes
- Makes calls to distributor ajax support controller
- Updates HTML with view returned from ajax controller
- Custom WCF Service:
- DistributorLocatorSupportService.svc
XslBasedPagePart App Block – Example: Gehl’s Part Listing
Component
|
Old
|
New
|
Inheritance
|
Implements XslBasedPagePart
|
Implements CmsComponentBase<XslViewData>
Implements IContentCmsComponent interface
|
Initialization
|
Done in LoadXml
- Set Xslt property
|
Done in InitializeCmsComponent
- Set ViewPath property (do not need StateData.ExpandBlock call)
- Initialize Model property – new XslViewData object
|
Rendering
|
Done in CmsRenderContents
- Set Xslt property
- Set up XslCompiledTransform
- Call .Transform()
|
Done in CmsRenderContents
- Write out call to render any supporting JS modules
- Do not need to override if not doing anything custom
|
UI Support
|
Done with JavaScript and Ajax Support controllers
|
Done with JavaScript and Ajax Support controllers
|
Web Control App Block – Example: