Custom Generic Content

Posted by Community Admin on 05-Aug-2018 04:10

Custom Generic Content

All Replies

Posted by Community Admin on 25-Nov-2010 00:00

In 3.7 it took me some time to create a Generic Content Item with my own wrapper and an extra field...basically my Generic Content User Control will contain a title and a HTML Editor...My class looks like:


public partial class UserControls_Generic_Content_RogueContent : System.Web.UI.UserControl
    [Category("Rogue Data")]
    public string Title get; set;

    [Category("Rogue Data")]
    public string Content get; set;

    protected void Page_Load(object sender, EventArgs e)
    
        TitleLabel.Text = Title;
        ContentLabel.Text = Content;
    

Simple...So if I go to my Page Editor and drag the control onto the page and Edit I will see two user configurable fields Title and Content...but my problem is Content is just a text box and I would love to be able to specify in the code behind to use the WYSIWYG Editor instead? Is there an easy way to do this or do I need to create a Custom View Template like in 3.7?

Posted by Community Admin on 25-Nov-2010 00:00

Hello Jerami,

You can use ContentBlock control which wraps RadEditor control. If you want to use a user control you cannot use the RadEditor in the context of a ControlDesigner. In this case you will need a custom control with a custom control designer. The control should inherit from SimpleView( if you do no intend to reuse one of the built-in controls as a basis). The control designer should inherit from ControlDesignerBase.

All the best,
Ivan Dimitrov
the Telerik team


Check out Telerik Trainer, the state of the art learning tool for Telerik products.

This thread is closed