More in this section

Forums / Developing with Sitefinity / developing control designer/type editor

developing control designer/type editor

6 posts, 0 answered
  1. Nick
    Nick avatar
    91 posts
    Registered:
    04 Aug 2008
    27 Oct 2009
    Link to this post
    Hi guys,

    I am looking to create a user control that allows the user to select a piece of generic content in a predefined (i.e. coded into the control itself - not user editable) category.

    I have read through the guides on creating control designers and type editors (not sure which would be more applicable here), and whilst i understand the majority of the code, some of the method's purposes are not explained. I also watched the webinar on the topic which also clarified things further but left some areas still uncovered.

    So i was wondering, if you would be so kind, could you give me a brief guide as to how to achieve my desired results?

    Thanks,
    Nick
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Oct 2009
    Link to this post
    Hi Nick,

    If you are going to use an user control, you should create a custom WebEditor which will shows only items from certain category. Generally you need to filter the list of content items using ContentFilterBuilder class and pass the leftOperand as Category, rightOperand will be your content item.
    Then you should select the content item from this category and return it to your control using Value property of WebUITypeEditor<String>.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Nick
    Nick avatar
    91 posts
    Registered:
    04 Aug 2008
    27 Oct 2009
    Link to this post
    Sorry, but i do not quite understand what you mean.

    Maybe i was not quite clear on what i desire. I wish for a Control which simply allows a user to select a generic content item from a specific category - i do not need to provide editing from the control, just the selection (and of course filtering) mechanism.

    then when the user clicks "i'm done" the control will render this specific item. I assume i have to create a type editor whose Value property returns the content item's GUID, but how would i, for example, create a drop down list which has the title of all of the GC items in this predefined category for the user to select.

    thanks for the incredibly speedy reply by the way. it probably makes perfect sense, but as this is my first venture into creating more sophisticated editing functionality on controls i'm a little confused by it all :-)
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Oct 2009
    Link to this post
    Hi Nick,

    I do not need to provide editing from the control, just the selection (and of course filtering) mechanism.

    I have not said anything about editing. If you are referring WebEditor , this is a Telerik.Cms.Web.UI attribute used to add a selector.

    then when the user clicks "i'm done" the control will render this specific item. I assume i have to create a type editor whose Value property returns the content item's GUID, but how would i, for example, create a drop down list which has the title of all of the GC items in this predefined category for the user to select.

    You need to create a class that inherits from WebUITypeEditor<String>. You should create a template for your WebUITypeEditor and list all items filtered by category name. Then when select the name from the RadComboBox or other control you should return in to the Value property.
    If you want to use the Guid instead of the name you should inherits from WebUITypeEditor<Guid>

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Nick
    Nick avatar
    91 posts
    Registered:
    04 Aug 2008
    27 Oct 2009
    Link to this post
    Ahh now it makes sense Ivan! Thanks for that, excuse my ignorance/confusion! i shall get on this, and report back if i have any further problems.

    Thanks again, the help is so much appreciated.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Oct 2009
    Link to this post
    Hello Nick,

    I will create a blog post in a few hours so you could take a look at Sitefinity's blogs. You can also find a sample code at http://www.sitefinity.com/support/code-library/sitefnity/userandcustomcontrols/custom-webeditor-datetime-picker.aspx

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered