ciao a tutti ho un problemino in c# con l’ Item_Command ,
ho scritto questa funzione
public void Item_Command(Object sender, DataGridCommandEventArgs e)
{
if (e.CommandName == "elimina")
{
DataRow dataRiga = getDataRow(DataGridForums.DataKeys[e.Item.ItemIndex].ToString());
dataRiga.Delete();
string strSql = "Delete From TabPost Where idPost=" + DataGridForums.DataKeys[e.Item.ItemIndex].ToString();
objUtente.ExInsertCommand(strSql);
}
}

che mi dovrebbe intercettare il CommandName per poi eliminare il record appropriato.
ho inserito anche nella funzione che mi crea visual studio
private void InitializeComponent()
{
this.DataGridForums.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHand ler(this.Item_Command); this.DataGridForums.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler (this.Item_Bound);
this.DataGridForums.SelectedIndexChanged += new System.EventHandler(this.DataGridForums_SelectedIn dexChanged);
this.Load += new System.EventHandler(this.Page_Load);

}
this.DataGridForums.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHand ler(this.Item_Command);

che mi dovrebbe intercettare l’evento come ho fatto con il itemDataBound che mi funziona ma con il ItemCommand non funziona, ho anche inserito nel datagrid l’evento OnItemCommand con il nome dell’funzione Item_Command ma niente,
qualcuna mi saprebbe dire come faccio a intercettare questo evetnto in c#?
grazie