开发者

WebformsMvp - Initializing the model

The question is simple. Let's say I have a model. I need default data to be loaded into the model on first page load. Where do I do this? I thought on performing the data load overriding the OnInit event but then the Presenter is not available by the time that event is being fired.

Any recommendations? I'm doing it by overridin开发者_开发知识库g the OnLoad method but for some reason the method is called twice, and loads the data twice as well.


You shouldn't need to override the OnLoad method, you should be attaching to the load event in the presenter. Populate the Model in the presenter in the load event. If you're overriding the built in methods you're not using the MVP framework as it's intended.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜