MVP design pattern question

Posted on 2007-10-08
Medium Priority
Last Modified: 2012-05-05
Hi experts,

I have events that get fired from my View and get handled in my Presenter
for example i might have in my View:
            this.radioButtonList.SelectedIndexChanged += delegate
                OnClassSelected(this.radioButton, EventArgs.Empty);
and OnClassSelected gets handled in my presenter:
void _view_OnClassSelected(object sender, EventArgs)

My problem is how can i use the sender parameter to for example get the selected value if I don't have access to System.Web.UI.WebControls to cast the sender object to a RadioButtonList?

Question by:kateL
  • 2
LVL 14

Expert Comment

by:Jai S
ID: 20038783
just cast it

Author Comment

ID: 20038807
what if my presenter is in a different project which does not have a reference to System.Web. That is the problem I mean.

What is the best practice in this case when using the MVP?

one solution would be to expose the SelectValue property though the interface but is this the best way?

I can see that it would get very cumbersome doing this if you had loads of controls to deal with
LVL 29

Accepted Solution

Gautham Janardhan earned 300 total points
ID: 20038833
this.radioButtonList.SelectedIndexChanged += delegate
                OnClassSelected(this.radioButton.SelectedValue, EventArgs.Empty);
LVL 14

Expert Comment

by:Jai S
ID: 20038853
no its not the best way to expose the selectedValue alone...

check this - may be you will get some idea...

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question