HowTo create ASP:Buttons in Code-Behind? (or just add an working Eventhandler to Standard-Buttons?)
<p>My Code works perfectly with normal Buttons. But i need to add some Code-Behind to those dynamically added Buttons. Thus i'd need ASP:Buttons instead of Standard-Buttons.
How do i do this?</p>

<p>At the moment my working Code looks like this (only the important parts):</p>

<pre><code>AjaxControlToolkit.AccordionPane nrX = new AjaxControlToolkit.AccordionPane();

Button b = new Button();
b.OnClick += Eventhandler(my_function);

nrX.ContentContainer.Controls.Add(b);
</code></pre>

<p>Currently the Eventhandler is not called. When i look at the produced source in the Browser, there is noch onclick Event or anything like that which is (i think) the problem.
So how can i change my "Button b" to an "ASPButton" b? Adding an attribute "runat="server"" doesn't do the trick, as this code is (of course) executed after the page_load...
Or am i getting something wrong?</p>
