Avatar of trevoray

asked on 

dynamically created button on datagrid is not firing item command

i have a datagrid in which i am dynamically creating template columns. the code i am using to create my delete button is as such..

      btn.Text = "Delete";
      btn.ID = "DeleteButton";
      btn.CommandName = "DeleteMe";
the HTML for the datagrid is as such...

<asp:datagrid id=DataGrid1 Width="700px" runat="server" BorderStyle="None" BackColor="White" CellPadding="5" GridLines="Horizontal" AutoGenerateColumns="False" Font-Size="Smaller" Font-Names="Arial" BorderWidth="0px" ShowFooter="True" onItemCommand="DataGrid1_ItemCommand" onItemDataBound="DataGrid1_ItemDataBound" DataKeyField="pay_adjust_id" AllowSorting="True">

the datagrid displays and fills properly. but when i press the delete button, the page reloads and the datagrid is gone. when i debug, it never makes it to the onItemCommand function. Can someone help me figure out why the onItemCommand function is not firing? Thanks!

Avatar of undefined
Last Comment

8/22/2022 - Mon