views:

82

answers:

1

The problem is SelectMethod and other actions execute twice. This has been difficult to isolate, as it only occurs on a larger solution, and not in simpler demo applications.

//.ascx
<asp:FormView runat="server" DataSourceID="userSource" DefaultMode="Edit">
    <EditItemTemplate>

<mvp:PageDataSource id="userSource" SelectMethod="GetUser" />

//code behind 
public User GetUser()
{
     //returning single item as FormView is only DefaultMode=edit
     return Model.User;
}

//presenter
public class UserOtherEditPresenter<IUserOtherEditView<UserEditViewModel>>

In an attempt to debug this here is the trace AXD file.

Update:

As it has been pointed out that initialization seems fine, so the problem must lie elsewhere in a conflict with some other aspect of the application.

A: 

I wanted to post this as a comment on your question but SO either isn't giving me that privilege because I have an insufficient number of badges (can I trade in FourSquare ones?), or the UX is just confusing me too much. Here's my non-answer answer:

Is the trace.axd you sent meant to demonstrate the problem? It all looks normal to me. It's only binding one presenter:

Creating presenter of type ADC.Logic.Presenters.UserOtherEditPresenter for view of type ADC.Logic.Views.IUserOtherEditView`1[[ADC.Logic.Views.Models.UserEditViewModel, ADC.Logic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]. (The actual view instance is of type ASP.controls_userotheredit_ascx.

According to the title of your question we'd expect to see this event twice.

However, the title and the content of your question don't match for me. You're saying the SelectMethod gets fired multiple times, which could indicate a problem with the PageDataSource.

Can you clarify please?

Tatham Oddie
Yes the page title I chose doesn't reflect what the actual problem is, it is in fact only the PageDataSource methods that are executing twice. I will amend the question title.
Nick Josevski
Cool - thanks. :)
Tatham Oddie