Text d"un hyperlink d'un datagrid
Bonjour à tous,
Voici mon souci :
J'ai un datagrid que je construit avec un dataset.
La première colonne contient un hyperlink pour lequel j'ai construit le lien (lienNom) grâce à mon dataset et lequel affiche la valeur Nom.
Code:
1 2 3 4 5
| <Columns>
<asp:HyperLinkField HeaderText="Nom" DataTextField="Nom" DataNavigateUrlFields="LienNom" />
<asp:BoundField HeaderText="Date d'inscription" DataField="DateValidation" DataFormatString="{0:d}"/>
<asp:BoundField HeaderText="Ratio fiabilité" DataField="Ratio" />
<Columns> |
Maintenant je lance une fonction c# sur l'event rowcommand de ce datagrid :
Code:
1 2 3 4 5 6 7 8
| if (e.CommandName == "Action1")
{
ImageButton btn_update = e.CommandSource as ImageButton;
GridViewRow row = btn_update.NamingContainer as GridViewRow;
int index = row.RowIndex;
string Nom = Datagrid.Rows[index].Cells[0].Text;
} |
Le problème c'est que je ne récupère rien dans ma variable Nom alors que je souhaiterais récupérer le Nom afficher.
Comment puis-je faire pour récupérer ce text ?
Par avance merci de votre aide !
Emilien