More in this section

Ascx + dll

4 posts, 0 answered
  1. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    07 Sep 2009
    Link to this post
    Hello,

    We need to provide our customers some of our Sitefinity controls. I'd like to know if there is a way to give them somehow an .ascx + .dll instead of .ascx + .ascx.cs?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Sep 2009
    Link to this post
    Hi Angel,

    It is possible. You can create a class that inherits form SimpleControl. Then override LayoutTemplateName property and create a private constant for the template name. Below is a sample code:

    public class Class1 : SimpleControl 
     
        // Instead of this you can use WebSysTemplate attribute 
        public override string LayoutTemplateName 
        { 
            get 
            { 
                return ItemTemplateName; 
            } 
        } 
     
        protected virtual Repeater MyRepeater 
        { 
            get 
            { 
                return base.Container.GetControl<Repeater>("myRepeater"true); 
            } 
        } 
     
        protected override void InitializeControls() 
        { 
            this.MyRepeater.DataSource = null
            this.MyRepeater.DataBind(); 
        } 
     
        private const string ItemTemplateName = "Telerik.Samples.ControlTemplates.Frontend.Item.ascx"
     
     
     

    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. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    07 Sep 2009
    Link to this post
    Hi Ivan,

    Thanks for the reply, but now I don't understand where the Class1.dll would be or is it compiled at all?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Sep 2009
    Link to this post
    Hello Angel,

    You need to compile Class1 to a dll. As you can see you have ItemTemplateName property where - you can embed the template for your control. You can also use external template by setting LayoutTemplatePath property - used to get/set the path to a custom layout template for a control.

    Let me know if there is anything else that we can do for you.

    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
4 posts, 0 answered