Designer problem with CompositeDataBoundControl

北城余情 提交于 2019-12-11 06:44:39

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/3079563/designer-problem-with-compositedataboundcontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!