You can find examples on google for this. This is how your code would look like if you are adding a button:
Button button = new Button();
button.Click += new EventHandler(ClickEventHandlerName);
Page.Controls.Add(button);
Dynamic controls should be added in PreRender.