hyperLinkField中的DataNavigateUrlFormatString属性不正执行javascript的解决办法

今天在做案子时候遇到用gridView控件时,想在里面有一个hyperlink,点击后弹出窗口再显示另外页面。可是在用DataNavigateUrlFormatString属性时,发现

<hyperlinkFiled DataNavigateUrlFormatString="javascript:window.open('abc.aspx?...."这样写后,原来可以点击的hyperlink变成不可点击了。上网找有文章说是这是微软的Bug.在DataNavigateUrlFormatString中不能有“:”。网上给出的解决办法有两种:一种是将上述代码用itemTemplate来代替:

http://blogs.msdn.com/b/jjameson/archive/2009/10/26/datanavigateurlformatstring-does-not-allow-javascript.aspx

<asp:GridView  runat="server"
    AutoGenerateColumns="False"
    ...>
    ...
    <Columns>
        <%-- HACK: Ideally, we would just use an asp:HyperLinkField,
        but there's a bug when specifying "javascript:" in the
        DataNavigateUrlFormatString:

        https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102300

        As a workaround, use a TemplateField instead. --%>
        <asp:TemplateField>
           <HeaderTemplate>Date</HeaderTemplate>
           <HeaderStyle CssClass="dateColumn" />
           <ItemTemplate>
               <a href='javascript:ShowItemDetail(<%# Eval("Id")%>)'>
                   <%# Eval("CreateTime", "{0:ddd MMM dd HH:mm}") %>
               </a>
           </ItemTemplate>
        </asp:TemplateField>
        ...
    </Columns>
</asp:GridView>

另外一种是用DataTextFormatString代替DataNavigateUrlFormatString。

http://www.vbforums.com/showthread.php?t=521952

<asp:HyperLinkField DataTextField="ID Control" DataTextFormatString="&lt;a href=javascript