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

推荐订阅源

Y
Y Combinator Blog
博客园 - 司徒正美
TaoSecurity Blog
TaoSecurity Blog
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
S
Secure Thoughts
博客园 - 三生石上(FineUI控件)
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
K
Kaspersky official blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
H
Help Net Security
博客园 - 叶小钗
爱范儿
爱范儿
GbyAI
GbyAI
I
Intezer
M
MIT News - Artificial intelligence
Latest news
Latest news
Schneier on Security
Schneier on Security
T
Tor Project blog
Simon Willison's Weblog
Simon Willison's Weblog
I
InfoQ
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
罗磊的独立博客
N
News and Events Feed by Topic
T
The Blog of Author Tim Ferriss
V2EX - 技术
V2EX - 技术
B
Blog
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Security Latest
Security Latest
V
V2EX
F
Fortinet All Blogs
Forbes - Security
Forbes - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Hacker News
The Hacker News
Scott Helme
Scott Helme
P
Privacy International News Feed
P
Palo Alto Networks Blog
H
Heimdal Security Blog
C
Cisco Blogs
T
The Exploit Database - CXSecurity.com
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
W
WeLiveSecurity
L
LINUX DO - 最新话题

博客园 - 星空竹月

Div中文字竖直居中的问题 ASP入门基础教程-VBScript概述及基本元素 第一次安装sql2000挂起无法安装的问题 asp.net(c#)成条形码[转] 关于文章列表如何直接显示文章类别名的问题 Page_PreInit在网页传值的应用 利用.net的强大功能发送email - 星空竹月 - 博客园 在页面和Datalist控件中判断是否为今天 - 星空竹月 - 博客园 如何在asp.net中关闭B页面时,自动刷新A页面? - 星空竹月 - 博客园 ASP.net(c#)做返回上一页效果(后退)--代码 前进和后退按钮特效代码 - 星空竹月 - 博客园 文件上传实例(文件上传,自动重命名,自动添加文件夹) ASP.NET中文显示乱码之解决方法 限制显示字数 将截断字符串或二进制数据。 IE6下透明PNG图片的显示 IE不支持PNG图片透明效果,怎么办 配置AjaxControlToolkit 怎样换网页中的鼠标图案??换成其他图片
asp.net中,限制显示字数的问题?
星空竹月 · 2007-08-26 · via 博客园 - 星空竹月

asp.net中,限制显示字数的问题?

悬赏分:0 - 解决时间:2006-8-30 09:06

我把下面这段放在TD里,目的是,如果超过35个字,在写省略号,后面显示[查看全文],点击[查看全文],打开 content.aspx 显示全文,但是这个id怎么传过去呢??
我像下面这样写,出现错误:
CS0117: “System.EventArgs”并不包含对“Item”的定义

<%# DataBinder.Eval(Container.DataItem,"content").ToString().Length > 35 ? (DataBinder.Eval(Container.DataItem,"content").ToString().Substring(0, 35)+"……      [<a href='content.aspx?id="+this.DataList1.DataKeys[e.Item.ItemIndex]+"'>查看全文</a>]" ): DataBinder.Eval(Container.DataItem,"content").ToString()%>

最佳答案

可以用修改sql语句的方法,从数据库中出来就做好了,还可以减少网络传输。
具体可case when 语句,下面给你一个例子
select mail_id,case when len(title)>16 then left(title,35)+'...' else title end as mail_title from mails
然后再加一个链接,指到查看全文的网页就可以了