How to create a CustomField for News?
I am trying the following:
using
Telerik.Sitefinity.Configuration;
using
Telerik.Sitefinity.Web.UI;
using
Telerik.Sitefinity.Web.UI.Fields.Config;
using
Telerik.Sitefinity.Web.UI.Fields.Definitions;
namespace
QUAY.Sitefinity.Modules
public
class
ThumbFieldElementDefinition : TextFieldDefinition
public
ThumbFieldElementDefinition() :
base
()
public
ThumbFieldElementDefinition(ConfigElement element) :
base
(element)
public
class
ThumbFieldElement : TextFieldDefinitionElement
public
ThumbFieldElement(ConfigElement parent) :
base
(parent)
public
override
DefinitionBase GetDefinition()
return
new
ThumbFieldElementDefinition(
this
);
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Web.UI.WebControls;
using
QUAY.Web.UI;
using
Telerik.Sitefinity.Web.UI;
using
Telerik.Sitefinity.Web.UI.Fields;
using
Telerik.Sitefinity.Web.UI.Fields.Enums;
using
Telerik.Web.UI;
using
Telerik.Sitefinity.Web.UI.Fields.Contracts;
using
Telerik.Sitefinity.Web.UI.Extenders.Definitions;
namespace
QUAY.Sitefinity.Modules
[FieldDefinitionElement(
typeof
(ThumbFieldElement))]
public
class
ThumbField : CustomControl, IField
private
Label titleLabel;
private
TextBox textBox;
private
HyperLink selectLink;
#region IField Members
public
void
Configure(IFieldDefinition definition)
//ITextFieldDefinition definition2 = definition as ITextFieldDefinition;
//if (definition2 != null)
//
// ExpandableControlDefinition definition3 = new ExpandableControlDefinition();
// definition3.ControlDefinitionName = definition2.ControlDefinitionName;
// definition3.ViewName = definition2.ViewName;
// definition3.SectionName = definition2.SectionName;
// definition3.FieldName = definition2.FieldName;
// definition3.Expanded = definition2.ExpandableDefinition.Expanded;
// //this.ExpandableControlDefinition = definition3;
// //this.Expanded = definition2.ExpandableDefinition.Expanded;
// //this.Rows = definition2.Rows;
// //this.value = definition2.Value;
// //this.Value = definition2.Value;
// //this.HideIfValue = definition2.HideIfValue;
//
public
string
Description
get
return
"Image"
;
set
public
string
Example
get
return
"Image"
;
set
public
string
ResourceClassId
get
return
"Image"
;
set
public
string
Title
get
return
"Image"
;
set
#endregion
QUAY.Sitefinity.Modules.ThumbField, QUAY.Sitefinity.Modules
Hi Bruno,
You can take a look at this post
www.sitefinity.com/.../creating_a_thumbnail_selector_for_news_items.aspx
Kind regards,
Ivan Dimitrov
the Telerik team
I am getting errors with that sample which prevents me from saving the news.
This control I made works, but I get all fields empty. What if I didn't want a image selector but a custom field selector? How could I make it?
---
Inheriting from TextField and overriding the controls and InitializeControls is even worse. The entire page bugs and no value is retrieved on the other fields.
...........
If anyone run on this problem be sure to:
Put the assembly info of your website to SitefinityWebApp because somewhere in Telerek's it is hard coded.
hi,
in 4.1 i keep getting the attached image whenever i click 'Back to News' without
editing the news article at all. using IE8.
thanks,
andrei
Hello Andrei,
"Back to News" is shown when you get an item for editing, so you mean that you are not editing the item fields/content? I am not able to replicate this issue with IE8. Are there issues with FF or Chrome?
Best wishes,
Ivan Dimitrov
the Telerik team
no, no issues in FF or Chrome. in IE8 however i found out that it does it only on a particular news item not on the others.
this 4.1 is behaving in some of the most strange ways. i guess i will have to delete that news item now???
andrei
Did you ever get this to work? I'm having the same problem with a DropDownList I added to the "basic" profile type. The label for the control is blank too.