Setting Hyperlink to a Javascript Url (using the DataNavigateUrlFormatString property)

Posted by Jangwenyi on Stack Overflow See other posts from Stack Overflow or by Jangwenyi
Published on 2010-06-18T10:57:00Z Indexed on 2010/06/18 11:33 UTC
Read the original article Hit count: 139

Filed under:
|

I have an issue where my Hyperlink field in Asp.net GridView is not accepting Javascript function that will open a popup dialog.

I am using the following snippet

 <asp:GridView ....
.
.
 <asp:HyperLinkField DataTextField="SomeColumn" HeaderText="Some Column Text" SortExpression="SomeColumn"
HeaderStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="javascript:LaunchSomePopupdialog({0})"
DataNavigateUrlFields="Id" ItemStyle-Font-Underline="true">

.
.
 </asp:GridView>  

However, when I use a page url, it works: E.g.

DataNavigateUrlFormatString="~/SomeOtherPage.aspx?Id={0}"

Is there a way I can make this work with my Javascript function?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about gridview