Widget Template - Modifying output of AssetsField control
I'm displaying an AssetsField control on the details-widget template for a custom module (projects). it looks like this
<
sf:AssetsField
ID
=
"download"
runat
=
"server"
DataFieldName
=
"Download"
/>
What is the resolution to this? I haven't yet found documentation for how to accomplish exactly what the original poster was doing.
Hi guys,
The default AssetsField control does not provide such functionality, so you will need to create a custom one.
What you need to do is to create a class, inherit from AssetsField and replace the template of the control with a custom one. Here is what your code should look like:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
Telerik.Sitefinity.Web.UI.Fields;
namespace
SitefinityWebApp
public
class
CustomAssets : AssetsField
protected
override
string
ScriptDescriptorTypeName
get
return
typeof
(AssetsField).FullName;
public
override
string
LayoutTemplatePath
get
return
layoutTemplatePath;
//set
//
// base.LayoutTemplatePath = value;
//
public
string
layoutTemplatePath =
"~/AssetsFieldCustomTemplate.ascx"
;
<
sf:DocumentLink
id
=
"documentLink"
runat
=
"server"
/>
You can get to it with code behind and modify it from there.
You can find the AssetsField's default template attached to this response or in our SDK by navigating to Content->Resources->WidgetTemplates.zip.