More in this section

Forums / General Discussions / Data Resolvers

Data Resolvers

4 posts, 0 answered
  1. Shawn
    Shawn avatar
    79 posts
    Registered:
    01 Jun 2010
    24 Nov 2010
    Link to this post
    Could someone explain how and when Data Resolvers are used (Settings -> Advanced -> Data -> Data Resolvers)?  My assumptions is that you they are applied to content prior to presentation so you can do some pre-processing of data.  The documentation is a little thin so any help is appreciated.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 Nov 2010
    Link to this post
    Hello Shawn,

    DataResolver resolves data properties for data binding - in most of the case the DataResolver is used when we bind a control to a list of content items and we need to resolve the url of the single content item and set it to a NavigateUrl property of a HyperLink control. When you click on the link you will go to details mode and you will see the single content item.

    sample

    link.NavigateUrl = DataResolver.Resolve(ContentItemDataItem, "URL", host.UrlKeyPrefix, null);

    For the resolver name you can use "URL" or "Author"

    LabelControl.Text = DataResolver.Resolve(dataItem, "Author", someformat);


    Sincerely yours,
    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
  3. Shawn
    Shawn avatar
    79 posts
    Registered:
    01 Jun 2010
    24 Nov 2010
    Link to this post
    I would like to do some pre-processing of Content before it's displayed...specifically to html content entered in the RadEditor. Exactly like what Sitefinity does to resolve hyperlinks and images with Telerik.Sitefinity.Web.UI.Utilities.LinkParser class.  I would like to take specific datatags and transform them.  For example, I would like to look for occurrences of {Year} and display DateTime.Now.Year in its place.  Basically, I would like to wire in classes similar to the LinkParser class that performs some logic on html..replaces values, etc..  Is there a way to accomplish this via configuration? 
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 Nov 2010
    Link to this post
    Hello Shawn,

    The only way to do this is by creating a custom class that inherits from the control you want to modify and override some of its method where the content data is bound. You also have to modify the control template which represents the data.

    If you want to do this for RadEditor control you should create a wrapper of the control similar to ContentBlok control.

    All the best,
    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 posts, 0 answered