Can I reset an event from the main page on ASPX?

Can I create a button click event on the main page to be processed by the event handler on the aspx page?

+3
source share
2 answers

You can relay the event. Announce a new relevant event on the main page, for example HelpClicked, and then aspx pages that use this wizard can subscribe to the event and process it accordingly. The wizard can also accept the default action if there are no subscribers (or use EventArgs with a processed property or something similar).

0
source

, :

:

public event EventHandler ButtonClick
{
  add { ButtonThatGetsClicked.Click += value; }
  remove { ButtonThatGetsClicked.Click -= value; }
}

:

protected override void OnLoad(EventArgs e)
{
  base.OnLoad(e);
  ((MyMasterType)Master).ButtonClick += MyHandler;
}

private void MyHandler(object sender, EventArgs e)
{
  //Do Something
}

, "", intellisense "", @ MasterType aspx.

+1

Source: https://habr.com/ru/post/1730497/


All Articles