I have the following GridView in ASP.NET:
<asp:GridView ID="GridView1" runat="server" DataKeyNames="ID" DataSourceID="AccessDataSource1">
<Columns>
<asp:HyperLinkField HeaderText="ID" DataTextField="ID" DataNavigateUrlFields="ID" DataNavigateUrlFormatString="_Ficha/?ficha={0}" SortExpression="ID" />
</Columns>
</asp:GridView>
I would like to access in C # the text of each link in the GridView column, but I always get an error.
I've tried it this way and it does not work:
GridView1.Rows[RowIndex].Cells[0].Text
I have also tried it in this other way and neither:
( (HyperLink) GridView1.Rows[RowIndex].Cells[0].Controls[0] ).Text
I attached an image of my GridView:
What I need is to be able to access the text of those links (for example, 1582, or 1583 ...) that appear in the "ID" column to save them in variables. I can not do it and I need help. Thank you! : (