Link to home
Create AccountLog in
Avatar of kateL
kateL

asked on

MVP design pattern question

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?

Thanks
Avatar of Jai S
Jai S
Flag of India image

just cast it
like
(RadioButton)sender
Avatar of kateL
kateL

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
no its not the best way to expose the selectedValue alone...

check this - may be you will get some idea...
http://www.codeproject.com/useritems/mvp_asp_net_net_remoting.asp
http://forums.asp.net/t/1036676.aspx