+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Online sandbox has images on their custom layout controls??

Online sandbox has images on their custom layout controls??

13 posts, 1 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    18 Jan 2011
    Link to this post
    Why am I unable to do that yet....or can I, and it's hidden somewhere.

  2. Jordan
    Jordan avatar
    172 posts
    Registered:
    20 Oct 2015
    19 Jan 2011
    Link to this post
    Hello Steve,

    I am attaching a step-by-step tutorial how to add custom layout widgets in your project.

    Kind regards,
    Jordan
    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
    Answered
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    19 Jan 2011
    Link to this post
    Thank you so much for that Jordan :)

    Ok, SOOO...if my layout is created in my control assembly, and at the top I link in a ResourceLink to a CSS file which defines those images as embedded resources IN my assembly...same deal, that'll work?
  4. Jordan
    Jordan avatar
    172 posts
    Registered:
    20 Oct 2015
    19 Jan 2011
    Link to this post
    Hello Steve,

    This will work for sure, it is pure CSS. The only problem will be if the CSS linked in your control is loaded before the Sitefinity's embeded styles. In such case just use !important.


    Kind regards,
    Jordan
    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
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    19 Jan 2011
    Link to this post
    Oh good, I was worried about iframe issues or something else

    I'll get on it, thanks!
  6. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    20 Jan 2011
    Link to this post
    One more quick ! if you dont mind...

    Is there some way to set that CssClass in the custom LayoutControl class?  I dont see an obvious property available (I'd just like the users to not have to enter it)
  7. Jordan
    Jordan avatar
    172 posts
    Registered:
    20 Oct 2015
    20 Jan 2011
    Link to this post
    Hi Steve,

    You can set a CSS class for the wrapper element when you register the widget.



    All the best,
    Jordan
    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
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    20 Jan 2011
    Link to this post
    Hey Jordan,
      Yeah I know, I saw that in the image, the question though was can I set it in the code so the user doesn't have to do that....like I set the Layout Template Name in the SimpleView code....
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    24 Mar 2017
    20 Jan 2011
    Link to this post
    Hello Steve,

    ResourceClassId is a configuration property. Generally you can access it from your custom control or using a custom configuration.

    Best wishes,
    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
  10. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    21 Jan 2011
    Link to this post
    So something like this in the layout?

    [ConfigurationProperty("ResourceClassId", "CssClass=Test")]

    Im not familar with config properties, says it needs to decorate a property but I dont see a CssClass property in LayoutControl
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    24 Mar 2017
    21 Jan 2011
    Link to this post
    Hi Steve,

    You have to work with the system configurations


                var t = Config.Get<ToolboxesConfig>().Toolboxes;
                var res = t.Values.First().Tools.First().Value.ResourceClassId;

    Best wishes,
    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
  12. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    24 Jan 2011
    Link to this post
    Hey Ivan,
    Ok, so this is what I ended up doing...

    public void AssignToolboxIcon(string cssClass) {
                if (this.IsDesignMode() == true) {
                    try {
                        string type = this.GetType().ToString();
                        var toolboxes = Telerik.Sitefinity.Configuration.Config.Get<ToolboxesConfig>().Toolboxes;
                        var layouts = toolboxes.Values.FirstOrDefault(x => x.Name == "PageLayouts");
                        foreach (var config in layouts.Tools) {
                            ToolboxItem tool = config.Value;
                            if (tool.ControlType == type) {
                                if (String.IsNullOrEmpty(tool.CssClass)) {
                                    tool.CssClass = cssClass;
                                }
                                break;
                            }
                        }
                    }
                    catch (Exception ex) {
                    }
                }
            }

    Does that look about right?....seems to work, but nothing persists
  13. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    24 Jan 2011
    Link to this post
    **Edit**

    Something just occurred to me...

    Where do I put the styling for this in my assembly such that when it's installed they all showup in the backend...

    I was attaching my custom designer css in the ResourceLink control but as I was playing around I realized that style wont be coming down unless there's a control on it...
13 posts, 1 answered