IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
After you Testimonials module: Create the Testimonials view, you need to create the Submit testimonial view widget designer.
To create the class for the view, perform the following.
using
System.Collections.Generic;
System.Web.UI;
Telerik.Sitefinity.Web.UI.ControlDesign;
public
class
SubmitTestimonialDesigner : ControlDesignerBase
{
}
To create the template of the designer view, perform the following:
<
div
=
"sfContentViews"
>
id
"RotatorOptions"
"groupSettingPageSelect"
ul
"sfTargetList"
li
label
for
"AutoPublish"
"sfTxtLbl"
>Auto-Publish Testimonials</
input
type
"checkbox"
/>
</
In the markup above, you defined a field for controlling whether to auto publish the testimonial.
To implement the ControlDesignerBase class in the SubmitTestimonialDesigner.cs file, perform the following:
private
string
_layoutTemplatePath =
"~/Modules/Testimonials/ControlDesigners/SubmitTestimonialDesignerTemplate.ascx"
;
override
LayoutTemplatePath
get
return
_layoutTemplatePath; }
set
{ _layoutTemplatePath = value; }
protected
LayoutTemplateName
null
; }
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
base
.DesignerMode = ControlDesignerModes.Simple;
You must store the client class in a JavaScript file in the project. The JavaScript file is where the view is located.
To create the file, perform the following:
Type.registerNamespace(
"SitefinityWebApp.Modules.Testimonials.ControlDesigners"
);
SitefinityWebApp.Modules.Testimonials.ControlDesigners.SubmitTestimonialDesigner =
function
(element) {
SitefinityWebApp.Modules.Testimonials.ControlDesigners.SubmitTestimonialDesigner.initializeBase(
this
, [element]);
SitefinityWebApp.Modules.Testimonials.ControlDesigners.SubmitTestimonialDesigner.prototype = {
initialize:
() {
SitefinityWebApp.Modules.Testimonials.ControlDesigners.SubmitTestimonialDesigner.callBaseMethod(
,
'initialize'
},
dispose:
'dispose'
refreshUI:
var
data =
._propertyEditor.get_control();
jQuery(
"#AutoPublish"
).attr(
'checked'
, data.AutoPublish);
applyChanges:
controlData =
controlData.AutoPublish = jQuery(
) ==
"checked"
SitefinityWebApp.Modules.Testimonials.ControlDesigners.SubmitTestimonialDesigner.registerClass(
'SitefinityWebApp.Modules.Testimonials.ControlDesigners.SubmitTestimonialDesigner'
, Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesignerBase);
if
(
typeof
(Sys) !==
'undefined'
) Sys.Application.notifyScriptLoaded();
For more information, see Overview: Widget designers.
You must reference the client component from the view class. You do this by overriding for the GetScriptReferences method. In it you must create a script reference for your client component. When creating the reference, you must specify the name of the embedded resource that contains the client component and the assembly it resides in. The name of the resource follows the same naming conventions as the name of the template. Add the following code in the GetScriptReferences method:
_scriptPath =
"~/Modules/Testimonials/ControlDesigners/SubmitTestimonialDesigner.js"
DesignerScriptPath
_scriptPath; }
{ _scriptPath = value; }
IEnumerable<ScriptReference> GetScriptReferences()
var scripts =
.GetScriptReferences()
as
List<ScriptReference>;
(scripts ==
)
.GetScriptReferences();
scripts.Add(
new
ScriptReference(DesignerScriptPath));
scripts.ToArray();
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important