views:

89

answers:

1

Hi,

Senario: Masterpage with a UserControl and a child ASPX page

In the past when using this senario I've used an Interface as a way to pass a value from the UserControl (embedded in a master page) to the masterpage code behind then consume that value in the child aspx page.

My question is now that asp.net 4 have arrived is this still a good way to achieve this or is there another or perhaps better way to do it? I've read somewhere that perhaps "delegates" is perhaps another route to take.

Any help much appreciated Lk

A: 

You could have your Masterpage inheret from a BaseMasterPage class that inherits from System.Web.UI.MasterPage. Then you can have a property on the BaseMasterPage. The user controls and child aspx pages can access the property by ((BaseMasterPage)this.Page).PropertyName

derek