使用gridview中的Hyperlink NavigateUrl属性打开一个新窗口 [英] Open a new window using Hyperlink NavigateUrl property inside gridview
本文介绍了使用gridview中的Hyperlink NavigateUrl属性打开一个新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我在gridview中有一个超链接.我试图在新窗口中打开链接.我发现下面的代码有效.但是,#039删除了所有的"\".如果删除#039,则不会生成代码.有什么想法使这项工作有效吗?
它必须是一个简单的修复程序,但是我花了很多时间无法使它正常工作.
提前非常感谢.
Hi
I have a hyperlink inside a gridview. Iam attempting to open the link on a new window. I found below code which works. However the #039 removes all "\". If I remove the #039, the code does not build. Any thoughts how to make this work?
It has to be a simple fix but I have spent much time unable to get this working.
Many thanks in advance.
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("FileLink", "javascript:openWindow('{0}');") %>' Text='<%# Eval("Name") %>' /> </asp:HyperLink>
</ItemTemplate>
我的JavaScript函数是
My javascript function is
function openWindow(path)
{
window.open(path,'','height=500,width=500');
}
推荐答案
我尝试运行您的代码,但工作正常.
#039;是必需的,因为它会在ur URL的开头和结尾添加''char,该字符将传递给JS函数,否则它将无法正常工作.
您还两次关闭了超链接标签
删除任何1个结束标签.
Tej Aj,
http://www.opexsoultion.com/forum
粉丝:
http://www.abtstudioz.com
I tried running ur code its working fine.
#039; is required coz it adds '' char at start and end of ur URL which is passed to JS function without which it won''t work.
also u hve closed ur hyperlink tag twice
remove any 1 closing tag.
Tej Aj,
http://www.opexsoultion.com/forum
Fan Of:
http://www.abtstudioz.com
这篇关于使用gridview中的Hyperlink NavigateUrl属性打开一个新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文