I have the following GridView with information columns and a Detail Hyperlink at the end of the row:
<cml:DataGrid ID="gvDados" DataKeyNames="Codigo_da_Agencia, Codigo_Do_Agente" runat="server" AutoGenerateColumns="False" AllowPaging="false"
SkinID="datagridSkin" TotalRecords="0" OnSelectedIndexChanged="gvDados_SelectedIndexChanged"
OnPageIndexChanging="gvDados_PageIndexChanging" HeaderStyle-Wrap="false">
<Columns>
<asp:BoundField DataField="Codigo_Do_Agente" HeaderText="Codigo_Do_Agente" SortExpression="Codigo_Do_Agente" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Codigo_Da_Agencia" HeaderText="Codigo_Da_Agencia" SortExpression="Codigo_Da_Agencia" ItemStyle-Wrap="false" />
<asp:BoundField DataField="Nome_Do_Contato" HeaderText="Nome_Do_Contato" SortExpression="Nome_Do_Contato" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Nome_Da_Agencia" HeaderText="Nome_Da_Agencia" SortExpression="Nome_Da_Agencia" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Telefone" HeaderText="Telefone" SortExpression="Telefone" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Numero" HeaderText="Numero" SortExpression="Numero" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Codigo_Do_Logradouro" HeaderText="Codigo_Do_Logradouro" SortExpression="Codigo_Do_Logradouro" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Apartamento" HeaderText="Apartamento" SortExpression="Apartamento" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Complemento" HeaderText="Complemento" SortExpression="Complemento" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="Codigo_Do_Bairro" HeaderText="Codigo_Do_Bairro" SortExpression="Codigo_Do_Bairro" ItemStyle-Wrap="false"/>
<asp:BoundField DataField="DTHR" HeaderText="DTHR" SortExpression="DTHR" ItemStyle-Wrap="false"/>
<asp:HyperLinkField DataTextField="Codigo_Da_Agencia" DataTextFormatString="Detalhe" DataNavigateUrlFields="Codigo_Da_Agencia, Codigo_Do_Agente"
HeaderText="Detalhes" DataNavigateUrlFormatString="../../Controls/Detalhes/Agencia.aspx?codigoAgencia={0}&codigoAgente={1}" Target="_blank" />
</Columns>
</cml:DataGrid>
Everything works fine, when the hyperlink is clicked it opens a new tab. But my problem is that the row is also selected.
I want to know if there is a way to prevent the row to be selected when the hyperlink is clicked. Or if there is a way to verify on the method PageIndexChanging in codebehind that was the last column that was clicked.
Thanks in advance!
RowSelectionorRowSelectedproperty that can be set on the GridView..? - MethodManHyperLinkField, try using aLinkButtoninsideTemplateField. - Bharadwaj