More in this section

Forums / Developing with Sitefinity / Initialising controls in a ContentView

Initialising controls in a ContentView

2 posts, 0 answered
  1. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    06 Feb 2010
    Link to this post
    Hi all,

    I'm writing a ContentView control for a custom module, which has both a listing of items, and a single item view.

    In the item listing view, I've added a couple of controls that I want to use for filtering - e.g. a text box and a dropdownlist.

    Unlike other controls, any controls inheriting from ContentView don't have an InitializeControls() method to override - what method should I be overriding to be able to initialise these extra controls in the ItemListTemplate? And is FindContentViewControl() the correct method for returning the controls within the current view?

    Regards,
    Alvaro

  2. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    07 Feb 2010
    Link to this post
    After a bit more digging around, I've ended up overriding the CreateContentList() method to populate any extra controls' properties as required, and used the SetSingleItemContent() method for setting the detail view controls.

    I have found the use of the GetControl<T>() method on both the ListContainer and SingleContainer properties to be the appropriate way to retrieve existing controls on the templates.


    Regards,
    Alvaro
2 posts, 0 answered