OnInit事件中的WebFormsMVP模型

时间:2013-05-21 13:59:40

标签: c# asp.net webformsmvp

我正在尝试在OnInit方法中添加基于模型的动态控件,但是我得到了"The Model property is currently null, however it should have been automatically initialized by the presenter. This most likely indicates that no presenter was bound to the control. Check your presenter bindings."错误。但是,如果我在OnLoad中添加控件,则它们无法正常工作 - 事件不会被触发。

此外,我在InitComplete事件

中看到了presenter绑定

代码:

    protected override void OnInit(EventArgs e)
    {

        base.OnInit(e);

        this.OnLoadTitle();

        foreach (var platform in Model.Title.Platforms)
        {
            var tab = CreateTabForPlatform(platform);
            this.TabView.Tabs.Add(tab);
        }
    }

我如何解决这个问题。谢谢你/

0 个答案:

没有答案