Hi,
I have a button in my datagrid, and an event handler for it which calls a function.. Only the eventhandler never calls the function, (or possibly the eventhandler never captures the button being pressed). Has any body had any similar problems or can anyone see any problems with my code:
Event Handler:
My Method:
My DataGrid
Thanks
James
I have a button in my datagrid, and an event handler for it which calls a function.. Only the eventhandler never calls the function, (or possibly the eventhandler never captures the button being pressed). Has any body had any similar problems or can anyone see any problems with my code:
Event Handler:
Code:
this.DataGrid1.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCommand);
My Method:
Code:
private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string myID = e.Item.Cells[2].Text;
if (e.CommandName == "cancel")
{
// Method here
}
DataGrid1.DataBind();
}
My DataGrid
Code:
<asp:ButtonColumn Text="Cancel" ButtonType="PushButton" HeaderText="Cancel" CommandName="cancel">
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
Thanks
James