Bonjour,
Je cherche depuis un certain temps des informations pour gérer l'évènement clic dans un gridview en ASP.NET C#.

J'ai trouvé certaines informations mais il m'en manque.
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	private void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex >= 0)
            {
                for (int cellIndex = 1; cellIndex < e.Row.Cells.Count; cellIndex++)
                {
                    e.Row.Cells[cellIndex].Attributes.Add("onmouseover", string.Format("this.style.cursor = 'hand'"));
                    e.Row.Cells[cellIndex].ToolTip = "test";
                    e.Row.Cells[cellIndex].Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(this.gridview1, "Select$" + e.Row.DataItemIndex, true);
                }
            }
        }
 
        private void gridview1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            String txt = this.gridview1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[???].Text;
        }
Ce qui me manque :
1) dans l'évènement RowCommand, comment avoir le numéro de la colonne?
2) comment gérer l'évènement clic sur une entête d'une colonne?
3) je souhaiterais exécuter une méthode C# lors du clic

Merci d'avance pour votre aide