Search code examples
asp.netcontrolsdatabound-controls

Designer problem with CompositeDataBoundControl


I have a custom class:

SimpleTemplatedControl : CompositeDataBoundControl

    private ITemplate _itemTemplate;
    [PersistenceMode(PersistenceMode.InnerProperty),
     TemplateContainer(typeof(SimpleItem)),
    ]
    public ITemplate ItemTemplate
    {
        get { return _itemTemplate; }// get
        set { _itemTemplate = value; }// set
    }   

    protected override int CreateChildControls(
        System.Collections.IEnumerable dataSource, 
        bool dataBinding)
    {
        //
    }

When I drop this on a webform I get such a smart tag in which I can choose a DataSource control. Pretty convinient. However if I add this attribute to this class:

[Designer(typeof(SimpleDesigner))]

I don't get to see that anymore but instead a smart tag to fill in my Template (also handy).

I would like to have both option available from within the same smart tag just like with a GridView control. How to accomplish this?


Solution

  • Which is the Designer type you're using? Normally it would be ControlDesigner but for the CompositeDataBoundControl you should use the DataBoundControlDesigner class to inherit your designer from.

    Grz, Kris.