Lireadabrieli
New Member
I use model view presenter approach for ASP.NET web site. The presentation part is compiled in separate class library where view contracts and presenters are defined:\[code\]MyPresentation assemblyIMyView{ DisplayText(string text);}MyPresenter{ public IMyView View { get; set; } public DisplayText() { string text = Generate(); View.DisplayText(text); } }MyWebApplication assemblypublic partial class MyForm : System.Web.UI.Page, IMyView{ public void DisplayText(string text) { this.myLabel.Text = text; } ... protected void myButton_Click(object sender, EventArgs e) { Presenter.DisplayText(); // calls this.DisplayText() } }\[/code\]However after stepping out of \[code\]Presenter.DisplayText()\[/code\] Text property of \[code\]myLabel\[/code\] becomes null again as though no assignment were done. By all means if you replace the only line in \[code\]myButton\[/code\] click event with direct setting of \[code\]myLabel\[/code\] Text property everything stays assigned.