Reputation: 23
I have a column in a asp grid which should be hyper-linked. Not only the header but the data bound to the column is also hyper-linked. When I click on any of the field's in the column it should trigger an event.
<asp:HyperLinkField HeaderText="HeaderCloumnName"
DataTextField="Data" DataNavigateUrlFields="link" />
Here "link" is an url but instead I want a method / even that should be triggered. How can I use Onclick event with hyperlink text that is fetched from the database?
Upvotes: 0
Views: 277
Reputation: 4642
You can't, as a HyperLinkField
renders out an <a />
tag which the browser just interprets as a link.
Instead you could use a ButtonField
and set its ButtonType
to a LinkButton
, or use a TemplateField
and add your own LinkButton
manually into the template.
Upvotes: 2