I add event handlers to this button:
btn.Click += new EventHandler(btn_Click);
However, the btn_Click function btn_Click not called (it never hits a breakpoint in it), and the button simply reloads the page. In my past experience, asp buttons usually execute click code before reloading the page, so how can I get this to happen when the event is dynamically added?
I also set CausesValidation = false , although there is no confirmation on the page, so I donโt think that would affect everything.
source share