Home All Groups Group Topic Archive Search About

Gridview hypterlink colomn to popup a new window

Author
2 Feb 2006 2:36 AM
Jasmine
Hi,
I added the script in the gridview hyperlink colomn for "
DataNavigateUrlFormatString = "javascript: var w= ...", but once I added
javascript here instead of " DataNavigateUrlFormatString
='mypopwin.aspx?ID={0}' ", the hyperlink text lost hyperlink, becomes regular
text, which means I can't click on it, how can I fix it?

Thanks , Jasmine

Author
5 Feb 2006 5:59 AM
Phillip Williams
Hello Jasmine,

There seems to be a subtle difference between the way the GridView’s
HyperLinkColumn behaves when the hyperlink is a javascript (instead of a Url)
and the way the DataGrid’s HyperLinkColumn used to behave.

http://www.webswapp.com/codesamples/aspnet20/hyperlinkfield/

In this demo I tried 4 scenarios:

1-  A HyperLinkField within a GridView: where I set the
DataNavigateUrlFormatString="javascript:alert('you selected {0}');"

2-  A HyperLink within an ItemTemplate inside a GridView; where I set the
NavigateUrl='<%# FormatLink(Eval("Text")) %>'

3-  A regular anchor tag (runat=”server”) within an ItemTemplate inside the
GridView where I set the href='<%# FormatLink(Eval("Text")) %>'

4-  The HyperLinkColumn within a DataGrid where I set the
DataNavigateUrlFormatString="javascript:alert('you selected {0}');"

Out of those 4 scenarios, the last 3 scenarios work but the first does not.


Show quoteHide quote
"Jasmine" wrote:

> Hi,
> I added the script in the gridview hyperlink colomn for "
> DataNavigateUrlFormatString = "javascript: var w= ...", but once I added
> javascript here instead of " DataNavigateUrlFormatString
> ='mypopwin.aspx?ID={0}' ", the hyperlink text lost hyperlink, becomes regular
> text, which means I can't click on it, how can I fix it?
>
> Thanks , Jasmine
>
>