0

When I click on button A, I create a button B, and when I click on the button B, the Click event doesn't fire. why?

Button A = new Button();
A.Click += A_Click;

A_Click:
Button B = new Button();
B.Click += B_Click;

B_Click:
//never fires
Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
Paul0PT
  • 106
  • 1
  • 18
  • Try the method here http://stackoverflow.com/questions/6187944/how-can-i-create-dynamic-button-click-event-on-dynamic-button – Paul Zahra Oct 25 '14 at 11:53
  • Where you attach these events?? – User2012384 Oct 25 '14 at 15:17
  • Can you post all relevant code to have a look? – User2012384 Oct 25 '14 at 15:18
  • Might be a problem related to dynamically created controls. You have to re-create them at the beginning of the PostBack in order to work correctly. Can you put the buttons on the page in markup with Visible set to false and just change Visible to true if you want to show a button? – Markus Oct 27 '16 at 14:49

0 Answers0