in which event can i handle the hyper link in the grid view?
-
01-06-2021 - |
Question
I have a gridview
which contains a hyper link as a template field ,now i wanna to use row command to handle the click on this hyperlink but,no command name or command argument for the hyper link .How to do this?
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink3" runat="server" Target="_blank" Font-Names="Tahoma"
Font-Size="Small">[HyperLink3]</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Note : i need to use Hyper link, not linkbutton .
Solution
GridView's RowDataBound Event .
you can find the link control and add an arribute to it.
HyperLink lnkObj = (HyperLink)e.Row.FindControl("HyperLink3");
lnkObj.Attributes.Add("onclick", <write your code> );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow