al click del bottone Info (... o meglio all'onitemcommand del datagrid non mi entra nella funzione della classe Dettagli

vi posto il tutto evidenziando in bold la parte in questione

P.S. Visto che è la prima pagina in aspx e c# accetto anche consigli e rimproveri su come ho strutturato il codice ....

In anticipo grazie


questa è la .aspx

<form runat="server">


<asp:datagrid id="myDataGrid" HeaderStyle-HorizontalAlign="Center" Runat="server" AutoGenerateColumns="False" BorderStyle="Solid" BorderWidth="1" BorderColor="#e6e6fa" Width="500px" HeaderStyle-BackColor="Gainsboro" ItemStyle-BackColor="#ffffff" AlternatingItemStyle-BackColor="#F6F6F6" HeaderStyle-Font-Bold="true" CellPadding="1" CellSpacing="1" OnItemCommand="Dettagli" OnItemDataBound="newInsert">
<Columns>
<asp:BoundColumn Visible="False" DataField="ricID" />
<asp:BoundColumn Visible="False" DataField="ricMEMO_RICHIESTA" />
<asp:BoundColumn HeaderText="Data" DataField="ricTMD_DATA" DataFormatString="{0:d}" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center"></asp:BoundColumn>
<asp:BoundColumn HeaderText="Titolo" DataField="ricSTR_TITOLO" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateColumn HeaderText="Info" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50px">
<ItemTemplate>
<asp:Button ID="btn" Text="Info" Runat="server" CommandName="info"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Reply" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50px">
<ItemTemplate>
<asp:Button ID="Button2" Text="Info" Runat="server" CommandName="reply"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<input id="ricInfo" type="hidden" value="richiesta" name="ricInfo">
</form>


....questa è la classe in c#

using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace gestione_clienti
{
/// <summary>
/// Descrizione di riepilogo per ric_visric.
/// </summary>
public class visRic : System.Web.UI.Page
{
protected DataSet objds = new DataSet();
protected int intMaxID;
protected OleDbConnection objConn = new OleDbConnection(ConfigurationSettings.AppSettings["JetConnection"]);
protected System.Web.UI.WebControls.Label lblInfo;
protected System.Web.UI.WebControls.DataGrid myDataGrid;
protected System.Web.UI.WebControls.Repeater rptReply;
private void Page_Load(object sender, System.EventArgs e)
{
// tabella richiesta
string strSQL = "SELECT * FROM TA_RICHIESTA WHERE ricID_CLIENTE LIKE '"+Session["User"]+"%'";
OleDbCommand objCommand = new OleDbCommand (strSQL, objConn);
OleDbDataAdapter objda = new OleDbDataAdapter(objCommand);
// tabella storico della richiesta
string strSQL2 = "SELECT * FROM TA_STORICO_RICHIESTA WHERE stoID_CLIENTE LIKE'"+Session["User"]+"%'";
OleDbCommand objCommand2 = new OleDbCommand (strSQL2, objConn);
OleDbDataAdapter objda2 = new OleDbDataAdapter(objCommand2);

try
{
objConn.Open();
objda.Fill(objds,"tRichiesta");
objda2.Fill(objds,"tStoricoRichiesta");
if (Request.RequestType == "POST" && Request.Form["ricInfo"] != "richiesta")
{
OleDbCommandBuilder objcb = new OleDbCommandBuilder(objda);
DataRow objdrUltimo = objds.Tables["tRichiesta"].Rows[objds.Tables["tRichiesta"].Rows.Count-1];
DataRow objdrNew = objds.Tables["tRichiesta"].NewRow();
// costruisco la nuova riga
objdrNew["ricID"] = (int)(objdrUltimo["ricID"])+1;
intMaxID = (int)objdrNew["ricID"];
objdrNew["ricID_CLIENTE"] = Session["User"];
objdrNew["ricID_RICHIESTA"] = Request.Form["selTipoRichiesta"];
objdrNew["ricSTR_TITOLO"] = Request.Form["titolo"];
objdrNew["ricMEMO_RICHIESTA"] = Request.Form["txt"];
objdrNew["ricTMD_DATA"] = DateTime.Now.Day+"/"+DateTime.Now.Month+"/"+DateTime.Now.Year;
objdrNew["ricVAL_COSTO"] =0;
objdrNew["rivVAL_VERSATO"] = 0;
// la attacco e aggiorno usando l'adapter builder
objds.Tables["tRichiesta"].Rows.Add(objdrNew);
objda.Update(objds, "tRichiesta");
string strCnt = "<div align='left'>Richiesta effettuata con successo
";
lblInfo.Text = strCnt;
// Costruisco l'origine dati per visualizzare il record appena inserito
}
// ogni volta che viene caricata la pagina effettua un binding dei dati
DataView objdw = new DataView(objds.Tables["tRichiesta"]);
myDataGrid.DataSource = objdw;
// Costruisco la tabella
myDataGrid.DataBind();
}
/*catch (Exception exOut)
{
string sMsg = "<P align='center'>

Si è verificato un problema:" +
"

Origine:
" + exOut.Source +
"

Descrizione:
" + exOut.Message +
"

Per favore, segnala il problema al webmaster.</P>";
this.lblInfo.Text = sMsg;
}*/
finally
{
if (objConn.State != ConnectionState.Closed)
{
objConn.Close();
}
}

}
public void Dettagli(object sender, DataGridCommandEventArgs objArgs)
{
Response.Write("Ciao");
if (objArgs.CommandName == "info")
{
//lblInfo.Text ="ciao";
string strCnt = objArgs.Item.Cells[1].Text;
lblInfo.Text = "<div align='left'>Testo della richiesta:"+"
"+strCnt+"
</div>";
}
else if(objArgs.CommandName == "reply")
{
DataView objdwReply = new DataView(objds.Tables["tStoricoRichiesta"]);
objdwReply.RowFilter = "stoID_RICHIESTA ='"+objArgs.Item.Cells[0].Text+"'";

//aggiorna il db
string strSQL = "UPDATE TA_RICHIESTA SET ricBOL_CLIENTEVIS ="+ 1 +" WHERE ricID ="+ objArgs.Item.Cells[0].Text;
OleDbCommand objCommand = new OleDbCommand(strSQL, objConn);
objConn.Open();
int nercord =objCommand.ExecuteNonQuery();
objConn.Close();

//DataRow objdwReply = new DataRow(objds.Tables["tStoricoRichiesta"].Rows.Find(objArgs.Item.Cells[0].Text));

if(objdwReply.Count != 0)
{
string strCnt = objdwReply[0]["stoMEMO_TESTO"].ToString();
lblInfo.Text = "<div align='left'>Risposta:"+"
"+strCnt+"
</div>";
}
else
{
lblInfo.Text = "<div align='left'>Risposta non disponibile</div>";
}
}
}

public void newInsert(object sender, DataGridItemEventArgs objArgs)
{
if (Request.Form["ricInfo"] != "richiesta")
{
ListItemType objItemType = (ListItemType)(objArgs.Item.ItemType);
if (objItemType == ListItemType.Item | objItemType == ListItemType.AlternatingItem)
{
DataRowView objRow = (DataRowView)(objArgs.Item.DataItem);
if((int)objRow["ricID"] == intMaxID)
{
objArgs.Item.ForeColor = Color.Red;
objArgs.Item.BackColor= Color.Pink;
}
}
}
ListItemType objItemType2 = (ListItemType)(objArgs.Item.ItemType);
if (objItemType2 == ListItemType.Item | objItemType2 == ListItemType.AlternatingItem)
{
DataRowView objRow = (DataRowView)(objArgs.Item.DataItem);
string bolVista = objRow["ricBOL_CLIENTEVIS"].ToString();
if(bolVista == "False")
{
objArgs.Item.BackColor = Color.Pink;
}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: questa chiamata è richiesta da Progettazione Web Form ASP.NET.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}