I've made a Template for adding controls to a DetailsView I have from code behind.
private class edgFooterTemplate : ITemplate
{
    private Button btn_Edit;
    public void InstantiateIn(Control container)
    {
        btn_Edit = new Button();
        btn_Edit.CausesValidation = false;
        btn_Edit.CommandName = "Edit";
        btn_Edit.ID = "btn_Edit";
        btn_Edit.Text = "Edit";
        container.Controls.Add(btn_Edit);
    }
}
My problem is that I want to add an event handler on the control but I can't access btn_Edit in the DetailsView I made from code-behind as well.