0
votes

In the master page I have a container on top of the page, which should hold buttons specific to the content page. In a content page, I have buttons like "Create", "Modify", etc... The container in the master page should always be on top, but the buttons will eventually change with different content. Any idea on how I can bind content page functionality to the one of the master page? Currently I have a panel in the master page and during run time, I attach the button from the content page, but the event handler is not attached and renders only a page reload. Why is that happening?

Thanks for the help!

Branko

2

2 Answers

1
votes

Use so technic: you controls implements IProducer interface and your Master page implements IConsumer interface.

IProducer will generate events (commands). Consumer will handle these events. I am using event that has command name (Create, Modify...) and arguments (string). Consumer will process these commands and update view (use Model View Presenter pattern also). Controls can implement IView also. For example, I have a code that does something the ASP.NET MVC does. IView gererates events, Presenter handles them, does something with Model (business layer, or data layer) and updates the view.

Luck.

0
votes

The easiest way (but not the most flexible) would be to add to your master page a new content placeholder inside the top panel and for each page to provide the buttons it needs along with any scripts and/code behind as a content for that place holder. Of course, that would make it slightly harder to mix page-specific buttons and common ones, but in most scenarios that's not needed anyway as the page-specific controls are grouped together.