Gridview : recupération clic ImageButton
Bonjour;,
J'ai fait un gridview, mais lorsque je clique sur mes ImageButton, j'arrive à recuperer la CommandName, mais je n'arrive pas à recuperer d'où vient ma ligne, et les champs Id et Version. Pourtant je recupere bien l'évement grdViewStructureTest_RowCommand, et j'ai bien défini dans ma datagrid DataKeyNames. Pourriez vous me dépanner
.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| <asp:GridView ID="grdViewStructureTest" runat="server" meta:resourcekey="grdViewListeApplicationsResource1"
AutoGenerateColumns="false" Width="600px" OnRowCommand="grdViewStructureTest_RowCommand" DataKeyNames="Id,Version">
<Columns>
<asp:BoundField HeaderText="Id" DataField="Id" Visible="false" />
<asp:BoundField HeaderText="Version" DataField="Version" Visible="false" />
<asp:HyperLinkField HeaderText="Nom" DataTextField="Nom" DataTextFormatString="{0:c}"
DataNavigateUrlFormatString="" />
<asp:BoundField HeaderText="Type" DataField="Type" />
<asp:BoundField HeaderText="Index" DataField="Index" />
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="cmdDescendreExercice" CommandName="cmdDescendreExercice"
runat="server" ImageUrl="~/_Images/fleche_Descendre.png" ToolTip="Descendre" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="cmdMonterExercice" CommandName="cmdMonterExercice" runat="server"
ImageUrl="~/_Images/fleche_Monter.png" ToolTip="Monter" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="cmdSupprimer" CommandName="cmdSupprimerExercice" runat="server"
ImageUrl="~/_Images/delete.gif" ToolTip="Supprimer" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView> |