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.
[ControlTemplateInfo(
"CustomControlResources"
,
"FriendlyName"
,
"WidgetArea"
)]
public
class
NewWidget : SimpleView
{
//rest of the widget implementation is below
"CustomControlResources"
- This is the resource name, I will describe how to create custom resource below.using
Telerik.Sitefinity.Localization;
using
Telerik.Sitefinity.Localization.Data;
namespace
SitefinityWebApp
{
[ObjectInfo(
"CustomControlResources"
, ResourceClassId =
"CustomControlResources"
)]
public
class
CustomControlResources : Resource
{
public
CustomControlResources()
{
}
public
CustomControlResources(ResourceDataProvider dataProvider)
:
base
(dataProvider)
{
}
[ResourceEntry(
"WidgetArea"
,
Value =
"WidgetArea"
,
Description =
"The title of this class."
,
LastModified =
"2009/05/13"
)]
public
string
BlogResourcesTitle
{
get
{
return
this
[
"WidgetArea"
];
}
}
[ResourceEntry(
"FriendlyName"
,
Value =
"Friendtly name of the control"
,
Description =
"description"
,
LastModified =
"2010/11/11"
)]
public
string
BlogsMasterViewFriendlyName
{
get
{
return
this
[
"FriendlyName"
];
}
}
}
}
protected
void
Application_Start(
object
sender, EventArgs e)
{
Bootstrapper.Initialized +=
new
EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(
this
.AfterInit);
}
private
void
AfterInit(
object
sender, ExecutedEventArgs args)
{
Res.RegisterResource<CustomControlResources>();
}
var initializer = SiteInitializer.GetInitializer();
initializer.RegisterControlTemplate(
"SitefinityWebApp.TestWidget.NewWidget.ascx"
,
typeof
(NewWidget).FullName,
"NewWidget"
,
null
,
"CustomControlResources"
,
"ASP_NET_TEMPLATE"
,
typeof
(NewWidget).Assembly.FullName,
"FriendlyName"
);
initializer.SaveChanges();
Subscribe to get all the news, info and tutorials you need to build better business apps and sites