I am trying to add an .net button dynamically to the radgrid footer with the following code. The button gets displayed correctly.
However, the btn_Click event does not get fired when the button is clicked.
Am I missing something in the code?
Thanks for your help.
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFooterItem)
{
GridFooterItem footerItem = (GridFooterItem)e.Item;
RadScriptManager1.RegisterAsyncPostBackControl(btn);
Button btn =
new
Button();
btn.Text =
"Button"
;
btn.Click +=
new
System.EventHandler(btn_Click);
footerItem.Cells[2].Controls.Add(btn);
}
}