I'm trying to implement MVP pattern (using webforms) for a project I'm working on, but I'm getting bogged down in what to do after an event, and in particular, one that originates from a gridview. Currently, view implements an interface so that presenter can call methods on the view.
My gridview contains what are essentially a number of cut down employee objects (although it does not know this), each with an ID that I'm already going to have to hide in the grid.
When certain buttons are pressed on the grid rows, differing events might occur (eg. delete, add to job, etc). The presenter needs to get access to the employee id in order to perform function (which will probably fire off a service layer command with said id). I'm trying to keep the View passive, but I think in this example it is impossible.
The way I see it, there are only small number of ways this can be done.
on gridrow select, populate a "selected ID field" within View's state (NOT gridrow id), and fire notify presenter (event or presenter call). Presenter will then access this field. Select Event needs to infer ID from gridview.
Pass Id direct to to presenter, either through parameter on presenter notify ( or Event Arguments if using events to notify presenter). Select Event needs to infer ID from gridview.
If this was a dropdown list it would be easy, as you could just use GetSelectedValue, and have a wrapper method around this (implementing the view interface method).
Hope you can help.
Thanks.