More in this section

Forums / Developing with Sitefinity / Implemeting the default template- from the tutorial

Implemeting the default template- from the tutorial

2 posts, 0 answered
  1. Scott
    Scott avatar
    3 posts
    01 Aug 2007
    07 Aug 2007
    Link to this post
    I've been following the tutorial for working with custom modules here

    and get it working up to a point.  I think the trouble is that there is a "// TODO : implement default template" in DefaultContactEditorTemplate.InstatiateIn on ContactEditor.cs.

    What exactly is supposed to be there? Do I need to create a template or is there just a line missing?

  2. Slavo
    Slavo avatar
    295 posts
    24 Sep 2012
    08 Aug 2007
    Link to this post
    Hello Scott,

    The ContactEditor control uses a template, which contains the controls that display when ContactEditor is used. This template can be an ascx file, which is specified in the web.config as a property for the module provider. There is code in the CreateChildControls() method of ContactEditor that checks to see if the path specified in the web.config is null. If so, it loads a default template, created in code. This is what the DefaultContactEditorTemplate class is - this default template. If execution reaches this point with the //TODO comment, this means that:

    1. You do not have a template .ascx file specifying the markup for the control


    2. You have the file, but it is not set as a property for the provider in web.config

    You can solve this, by creating the needed controls and markup in code, exactly where the //TODO comment is. You can create the controls that you need to display programatically. You can also create the template in an ascx file.

    Here is a sample of how it looks: I suggest doing both, just in case something messes up with the path to the ascx file.
    You can see which property to set in web.config, by looking at the ContactsProvider class. In the Initialize method, there is code checking web.config for values. The property specifying the ContactEditor template is currently called "contactEditorTemplate".

    Hope this makes it a little clearer.

    All the best,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered