I've seen code to handle MasterPage events in the content Page, but if I'm loading a UserControl dynamically into the Page, can I handle the event in the UserControl instead?
Basically I have a button on the MasterPage, when it's clicked I need to make the UserControl do something, such as display text or change a value in a form.
Failing that, is it possible to make an event from one dynamically loaded User开发者_如何学JAVAControl fire in another on the same page? I could then replace the button in the MasterPage with one in another UserControl
Thanks all.
This is very similar to this stackoverflow question.
The answer to that question should also apply to yours: your Page knows its master and knows its child controls. It can wire-up a handler on the child control to an event on the master page, so the child control can perform necessary functionality when the even occurs on the master page.
精彩评论