Right now I have a datagrid with a template column as follows:
<asp:TemplateColumn> <ItemTemplate> <asp:HyperLink ID="lnkSelect" runat="server" Target="_blank" /> </ItemTemplate></asp:TemplateColumn>
The OnItemDataBound method builds the NavigateURL property of the Hyperlink dynamically, based on another column in this datagrid, which contains a GUID. Selecting a row by clicking on the hyperlink brings up a Dynamics CRM web page for the Contact with that GUID. This program is launched from a ribbon button click in CRM, via a JScript.
This system works fine but I find I now need to intercept that click event. I tried adding a OnSelectedIndexChanged event but this was ignored; execution did not seem to stop there.
Is there any way to intercept the hyperlink click, or, conversely, is there another control I can use that will allow building dynamic URLs and also interception of a click event?
Thank you.
You will have to do this on client, specifically in “onclick” event.
Create a JavaScript function, e.g.
clickIntercept()that would perform nessessery operations befor navigation; then in the code where you assign NavigateURL property assign “onclick” attribute with the value of “clickIntercept”.