More in this section

Forums / Developing with Sitefinity / New generic content control for toolbox

New generic content control for toolbox

7 posts, 0 answered
  1. Chris
    Chris avatar
    87 posts
    Registered:
    11 May 2010
    01 Jul 2010
    Link to this post
    I would like to create a new control for the toolbox which will let me select items from my generic content based module.

    This will be the same as the standard generic content designer except I want to restrict to text only input via a textbox rather than HTML input, and ideally restrict the user to only selecting content from one module.

    Can you advise on how I might be able to achieve this?
  2. Chris
    Chris avatar
    87 posts
    Registered:
    11 May 2010
    01 Jul 2010
    Link to this post
    I've been experimenting with this method of changing the generic content control but I haven't been able to see how I can get the behaviour I want - http://www.sitefinity.com/devnet/kb/sitefinity-3-x/how-to-wrap-a-generic-content-control-in-3-6-sp1.aspx
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    01 Jul 2010
    Link to this post
    Hi Chris,

    You could take a look at the links below were you could see how to create a custom content selector.

    Custom WebUITypeEditor
    ContentSelector ID

    GenericContent control wraps RadEditor control so you can use Edit modes enumerator to disable the HTML mode.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Chris
    Chris avatar
    87 posts
    Registered:
    11 May 2010
    01 Jul 2010
    Link to this post
    Hi Ivan,

    I have managed to create a WebUITypeEditor which is displaying in my control, and it populates the ID field, however when I select the content the type editor does not close like the generic content one. How do I make it close upon selection of an item of content?

    Thanks,

    Chris.
  5. Chris
    Chris avatar
    87 posts
    Registered:
    11 May 2010
    01 Jul 2010
    Link to this post
    Would it be possible to simply inherit from the generic content type editor and override a few properties to get the functionality I need? It looks as though it may be possible as I would only need to override the modules drop down list items, but I don't know which class to inherit from.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    01 Jul 2010
    Link to this post
    Hi Chris,

    You could inherit from GenericContent control. There is a public virtual property called Guid that you can override with a custom one and assign a selector to it.  The selector used by Generic Content control is Telerik.Cms.Engine.WebControls.ContentSelector. The control used ObjectDataSource to populate the RadGrid. Here you can override CreateChildControls and subscribe for the Grid events

    this.ItemsGrid.RowDataBound += this.ItemsGrid_RowDataBound;
    this.ItemsGrid.RowCommand += this.ItemsGrid_RowCommand;

    Inside CreateChidControls you should not call call the base. If you want just to hide the providers list you could call ProvidersList.Visible = false. There is a public virtual property ProvidersList that you can access and override if necessary.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Chris
    Chris avatar
    87 posts
    Registered:
    11 May 2010
    02 Jul 2010
    Link to this post
    I realised that it is in fact the control designer I need to change. I imagine this is a much trickier object to modify by inheritance, and I would probably be better off creating a new designer.
Register for webinar
7 posts, 0 answered