0

Can anyone explain how to implement MVP pattern for SharePoint Webparts when you have user controls (with dropdowns) and webpart properties (or even more editorparts).

Thank you so much.

sssreddy
  • 282
  • 1
  • 3
  • 15

1 Answers1

0

Treat the webpart controls and the webpart properties (including the data they store) as view code. You really don't want to persist any domain model information inside the webpart properties. This makes it easier to create a presenter interface the both the webpart property and webpart control views can call to retrieve domain model information.

Create a decent factory to get an instance of the presenter and your code should be nicely separated.

Nat
  • 14,175
  • 5
  • 41
  • 64
  • The problem is i have user controls (1 or 2 per webpart) (which I have considered as view). Now i could not figure out how webpart properties would be connected. If I make the webpart class implement view, I do not know how to set data (esp drop downs). I could make presenter set properties in webpart which inturn sets properties in user control, but I do not know if thats the right approach. – sssreddy Jul 26 '11 at 00:44