到外部站点,如果它是一个超链接 [英] go to external site if it's an hyperlink
本文介绍了到外部站点,如果它是一个超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在每一行的GridView一个查看链接到一个aspx页面。
I have a "view" link to an aspx page in a gridview for each row.
根据资源的类型1)文件或2)超链接,它应该或者下载文件,或去中提到的超链接。
Depending on the type of resource 1)File or 2)Hyperlink , it should either download the file or go to the hyperlink mentioned.
<asp:TemplateField HeaderText="View">
<ItemTemplate>
<a id="View" href="../resources/ResourceFile.aspx?Id=<%# Eval("Id")%>" target="_blank">View</a>
</ItemTemplate>
</asp:TemplateField>
我得到它的工作的文件类型,但我怎么重定向到一个外部链接,如www.yahoo.com如果它是一个超链接。
I got it working for the file type but how do I redirect to an external link like "www.yahoo.com" if it's an hyperlink.
在背后
if(resource.ResourceType.ToLower().Equals("hyperlink")){
// what should i do here?
// the link is stored in resource.value
}
编辑:想通链接应该有一个http:// preFIX工作。现在感觉愚蠢的:)
EDIT : Figured that the link should have an http:// prefix to work. Feeling stupid now :)
推荐答案
想通链接应该有一个的http://
preFIX工作
Figured that the link should have an http://
prefix to work.
这篇关于到外部站点,如果它是一个超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文