Problems with Custom Designer Tutorial
Hi team,
I've been following this tutorial with sitefinity 4.2
with no real effects in the properties editor of the widget. (screenshot attached)
please watch my attached code for some inconsistences
thanks!
ucBannerDesignerTemplate.ascx
<
div
>
<
asp:TextBox
ID
=
"tb1"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<%@ Control Language="C#" %>
<
div
>
<
h1
>SOMETEXT</
h1
>
<
asp:Literal
ID
=
"LikeBoxHtml"
runat
=
"server"
/>
</
div
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
//
using
Telerik.Sitefinity;
using
Telerik.Sitefinity.Web.UI.ControlDesign;
namespace
SitefinityWebApp.UserControls
public
class
ucBannerDesigner : ControlDesignerBase
// embedded resources
private
const
string
LayoutTemplateReference =
"SitefinityWebApp.UserControls.ucBanner.ucBannerDesignerTemplate.ascx"
;
private
const
string
DesignerScriptReference =
"SitefinityWebApp.UserControls.ucBanner.ucBannerDesigner.js"
;
protected
override
void
InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
base
.DesignerMode = ControlDesignerModes.Simple;
protected
override
string
LayoutTemplateName
get
return
null
;
public
override
string
LayoutTemplatePath
get
return
"~/TestUserControls/"
+ LayoutTemplateReference;
set
base
.LayoutTemplatePath = value;
public
override
IEnumerable<System.Web.UI.ScriptReference> GetScriptReferences()
var res =
new
List<System.Web.UI.ScriptReference>(
base
.GetScriptReferences());
var assemblyName =
this
.GetType().Assembly.GetName().ToString();
res.Add(
new
System.Web.UI.ScriptReference(DesignerScriptReference, assemblyName));
return
res.ToArray();
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.ComponentModel;
//
using
Telerik.Sitefinity.Web.UI;
using
Telerik.Sitefinity.Web.UI.ControlDesign;
using
System.Text;
using
Telerik.Sitefinity;
namespace
SitefinityWebApp.UserControls
[ControlDesigner(
typeof
(SitefinityWebApp.UserControls.ucBannerDesigner))]
public
partial
class
ucBanner : SimpleView
#region properties
private
string
_srcImagen =
"http://www.fusiona.cl/images/imgLogoFusiona.jpg"
;
private
string
_link =
"http://www.fusiona.cl/"
;
private
string
_linkTarget =
"en un lightbox"
;
private
string
_lboxWidth =
"640"
;
private
string
_lboxHeight =
"480"
;
public
string
srcImagen
get
return
_srcImagen;
set
_srcImagen = value;
public
string
link
get
return
_link;
set
_link = value;
public
string
linkTarget
get
return
_linkTarget;
set
_linkTarget = value;
public
string
lboxWidth
get
return
_lboxWidth;
set
_lboxWidth = value;
public
string
lboxHeight
get
return
_lboxHeight;
set
_lboxHeight = value;
#endregion
protected
virtual
TextBox tb1
get
return
this
.Container.GetControl<TextBox>(
"tb1"
,
true
);
set
this
.tb1.Text = value.Text;
protected
override
string
LayoutTemplateName
get
return
null
;
public
override
string
LayoutTemplatePath
get
return
"~/TestUserControls/"
+
"SitefinityWebApp.UserControls.ucBanner.ucBanner.ascx"
;
set
base
.LayoutTemplatePath = value;
protected
override
void
InitializeControls(GenericContainer container)
tb1.Text =
"test string"
;
Type.registerNamespace(
"SitefinityWebApp.UserControls"
);
SitefinityWebApp.UserControls.ucBannerDesigner =
function
(element)
SitefinityWebApp.UserControls.ucBannerDesigner.initializeBase(
this
, [element]);
SitefinityWebApp.UserControls.ucBannerDesigner.prototype =
initialize:
function
()
SitefinityWebApp.UserControls.ucBannerDesigner.callBaseMethod(
this
,
'initialize'
);
,
dispose:
function
()
SitefinityWebApp.UserControls.ucBannerDesigner.callBaseMethod(
this
,
'dispose'
);
,
refreshUI:
function
()
var
data =
this
._propertyEditor.get_control();
jQuery(
"#tb1"
).val(data.tb1);
,
applyChanges:
function
()
var
controlData =
this
._propertyEditor.get_control();
controlData.tb1 = jQuery(
"#tb1"
).val();
,
get_controlData:
function
()
return
this
.get_propertyEditor().get_control();
,
get_propertyEditor:
function
()
return
this
._propertyEditor;
SitefinityWebApp.UserControls.ucBannerDesigner.registerClass(
'SitefinityWebApp.UserControls.ucBannerDesigner'
, Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesignerBase);
if
(
typeof
(Sys) !==
'undefined'
) Sys.Application.notifyScriptLoaded();
Not help necessary by now... i'm already solve it
the problem was in the file "ToolboxesConfig.config"
<!--<add enabled=
"True"
type=
"~/UserControls/ucBanner/ucBanner.ascx"
title=
"ucBanner"
visibilityMode=
"None"
name=
"ucBanner"
/>-->
replaced with:
<add enabled=
"True"
type=
"SitefinityWebApp.UserControls.ucBanner, SitefinityWebApp"
title=
"ucBanner"
visibilityMode=
"None"
name=
"ucBanner"
/>