惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
博客园 - 聂微东
小众软件
小众软件
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
TaoSecurity Blog
TaoSecurity Blog
博客园 - 司徒正美
罗磊的独立博客
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
S
Security @ Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
月光博客
月光博客
S
Secure Thoughts
P
Proofpoint News Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Forbes - Security
Forbes - Security
H
Heimdal Security Blog
W
WeLiveSecurity
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
L
LangChain Blog
T
The Blog of Author Tim Ferriss
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
Cloudbric
Cloudbric
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cisco Blogs
博客园 - 三生石上(FineUI控件)
博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Schneier on Security
Project Zero
Project Zero
SecWiki News
SecWiki News
爱范儿
爱范儿
The Register - Security
The Register - Security
AI
AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Y
Y Combinator Blog
L
Lohrmann on Cybersecurity
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Privacy International News Feed
J
Java Code Geeks
S
Securelist
C
Cyber Attacks, Cyber Crime and Cyber Security
V
Visual Studio Blog

博客园 - 流浪浪

使用递归的方法生产TreeView SQL截取字符串 SQL Server中各个系统表的作用 editor.js 缺少对象的解决方法(ewebeditor 使用) vs2005 c#鼠标悬停高亮显示在gridview中 li:hover ul,li.over ul{ display: block;}这句被ie6.0解释不了 CSS + JavaScript 利用display:none/block 构造弹出菜单 23种设计模式的通俗理解 myeclipse9.0破解方法 C#弹出选择对话框的程序 sql语句中调用将汉字转换为拼音函数 sql将汉字首字转化为拼音 “IE7中Frameset页面显示不全”问题的原因与解决方案 (转) sql语句获取本周、本月数据 解决gridview导出到excel中汉字出现乱码的问题 - 流浪浪 - 博客园 (转)IT人士群聚喝酒 Better Man 倒春寒 恨铁不成钢啊!
asp.net DataList中hyperlink传递参数及打开新页面全解
流浪浪 · 2011-12-09 · via 博客园 - 流浪浪

最近做个小东西,发现DataList中hyperlink传递参数不好做,找了许多论坛、文章都不尽如人意,后来经过自己捉摸,终于找到了实现的方法,现在贴出来大家共享!

在aspx页面源码中书写方式如下:

<asp:HyperLink ID="HyperLink1" runat="server"  Width="177px" NavigateUrl='<%# "ToGoal.aspx?ID=" +  DataBinder.Eval( Container.DataItem,"ID") %>' ><%# DataBinder.Eval( Container.DataItem,"Text") %></asp:HyperLink></td>
做完这个之后感觉有点不太满意,因为我想打开新的页面,而不是在原页面进行跳转,原来经常使用的
 response.write("<script language=javascript>window.open('new.aspx');</script>")
 会被认为是弹出窗口被浏览器屏蔽,所以只好想其他办法。后来发现写成下边这样就可以了。
<asp:HyperLink ID="HyperLink1" runat="server"  Width="177px"  ><a href="http://www.sina.com"  target="_blank"><%# DataBinder.Eval( Container.DataItem,"Text") %></a></asp:HyperLink></td>如果你的链接地址是从数据库取出来的,那就写成下边这样:
<asp:HyperLink ID="HyperLink1" runat="server"  Width="177px"  ><a href='<%# "http://" +  DataBinder.Eval( Container.DataItem,"Url") %>' target="_blank"><%# DataBinder.Eval( Container.DataItem,"Url") %></a></asp:HyperLink></td>