Datalist数据内容显示问题(如图)

hnghng 2006-05-06 03:41:01
我添加了title用于在鼠标放到,标题上是显示完整的标题,但是怎么都不能完整显示。

<itemtemplate>
<a title="<%# DataBinder.Eval(Container.DataItem,"Title") %>" href="ReadNews.aspx?NewsID=<%# DataBinder.Eval(Container.DataItem,"NewsID") %>"target=_blank><font color="#cc3333">·</font> <%# DataBinder.Eval(Container.DataItem,"Title") %>…
</a>
</itemtemplate>
图片1如下:http://blog.csdn.net/images/blog_csdn_net/hnghng/200154/r_p1.gif
图片2如下:http://blog.csdn.net/images/blog_csdn_net/hnghng/200154/r_p2.GIF
  如果在datalist上显示数据内容过长怎么分行显示?
   
  回答正确的给分。

...全文
288 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
cat_hsfz 2006-05-06
  • 打赏
  • 举报
回复
<a href="###" title="Hello
World">Hello<br />World</a>

这时候链接和title显示的HelloWorld都是分两行的。title的识别方法和<textarea>内部的有点像,就是直接识别格式,是换行就识别为换行。
insiderc 2006-05-06
  • 打赏
  • 举报
回复
//日期转换
DateTime.Parse("2006-06-17 12:52:03").ToShortDateString();
insiderc 2006-05-06
  • 打赏
  • 举报
回复
//显示换行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0048)http://qingaaa.nnjh.com/dvbbs/list.asp?boardid=9 -->
<HTML><HEAD><TITLE>论坛</TITLE>
<META charset=GB2312 content="MSHTML 6.00.2600.0" name=GENERATOR>
<SCRIPT language=javascript>
function openUser(id) {
var Win = window.open("dispuser.asp?name="+id,"openScript");
}

function openScript(url, width, height){
var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}

function openDis(bid,rid,id){
self.location="dispbbs.asp?boardid="+bid+"&RootID="+rid+"&id="+id
}

function PopWindow()
{
openScript('messanger.asp?action=newmsg',420,320);
}
var nn = !!document.layers;
var ie = !!document.all;

if (nn) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalSystemClipboardAccess");
var fr=new java.awt.Frame();
var Zwischenablage = fr.getToolkit().getSystemClipboard();
}

function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
</SCRIPT>

<SCRIPT language=JavaScript>
//***********默认设置定义.*********************
tPopWait=50;//停留tWait豪秒后显示提示。
tPopShow=5000;//显示tShow豪秒后关闭提示
showPopStep=20;
popOpacity=99;

//***************内部变量定义*****************
sPop=null;
curShow=null;
tFadeOut=null;
tFadeIn=null;
tFadeWaiting=null;

document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { background-color: #F8F8F5;color:#000000; border: 1px #000000 solid;font-color: font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");
document.write("</style>");
document.write("<div id='dypopLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");


function showPopupText(){
var o=event.srcElement;
MouseX=event.x;
MouseY=event.y;
if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
if(o.dypop!=sPop) {
sPop=o.dypop;
clearTimeout(curShow);
clearTimeout(tFadeOut);
clearTimeout(tFadeIn);
clearTimeout(tFadeWaiting);
if(sPop==null || sPop=="") {
dypopLayer.innerHTML="";
dypopLayer.style.filter="Alpha()";
dypopLayer.filters.Alpha.opacity=0;
}
else {
if(o.dyclass!=null) popStyle=o.dyclass
else popStyle="cPopText";
curShow=setTimeout("showIt()",tPopWait);
}

}
}

function showIt(){
dypopLayer.className=popStyle;
dypopLayer.innerHTML=sPop;
popWidth=dypopLayer.clientWidth;
popHeight=dypopLayer.clientHeight;
if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
else popLeftAdjust=0;
if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
else popTopAdjust=0;
dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
dypopLayer.style.filter="Alpha(Opacity=0)";
fadeOut();
}

function fadeOut(){
if(dypopLayer.filters.Alpha.opacity<popOpacity) {
dypopLayer.filters.Alpha.opacity+=showPopStep;
tFadeOut=setTimeout("fadeOut()",1);
}
else {
dypopLayer.filters.Alpha.opacity=popOpacity;
tFadeWaiting=setTimeout("fadeIn()",tPopShow);
}
}

function fadeIn(){
if(dypopLayer.filters.Alpha.opacity>0) {
dypopLayer.filters.Alpha.opacity-=1;
tFadeIn=setTimeout("fadeIn()",1);
}
}
document.onmouseover=showPopupText;
</SCRIPT>

<STYLE type=text/css>A:visited {
COLOR: #000000; TEXT-DECORATION: none
}
A:active {
COLOR: #000000; TEXT-DECORATION: none
}
A:hover {
COLOR: #000000; TEXT-DECORATION: underline
}
A:link {
COLOR: #000000; TEXT-DECORATION: none
}
.t {
LINE-HEIGHT: 1.4
}
BODY {
FONT-SIZE: 12px; SCROLLBAR-HIGHLIGHT-COLOR: #9bdbdb; SCROLLBAR-SHADOW-COLOR: #9bdbdb; COLOR: #000000; SCROLLBAR-3DLIGHT-COLOR: #9bdbdb; SCROLLBAR-TRACK-COLOR: #ffffff; FONT-FAMILY: "宋体"; SCROLLBAR-DARKSHADOW-COLOR: #9bdbdb; SCROLLBAR-BASE-COLOR: #9bdbdb
}
TD {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: "宋体"
}
P {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: "宋体"
}
DIV {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: "宋体"
}
BR {
FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: "宋体"
}
FORM {
FONT-SIZE: 12px; FONT-FAMILY: "宋体"
}
OPTION {
FONT-SIZE: 12px; FONT-FAMILY: "宋体"
}
INPUT {
BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; FONT-FAMILY: "宋体"; HEIGHT: 18px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc
}
TEXTAREA {
BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: "宋体"; BACKGROUND-COLOR: #efefef; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000
}
SELECT {
BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: "宋体"; BACKGROUND-COLOR: #eeeeee; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000
}
</STYLE>
</HEAD>
<BODY vLink=#333333 aLink=#333333 link=#333333 bgColor=#ffffff leftMargin=0
topMargin=0>
<BR>
<TABLE borderColor=#5e94a2 cellSpacing=0 cellPadding=0 width="95%" align=center
border=1>
<TBODY>
<TR align=middle>
<TD><A
title="《复杂的奇怪的密码》<br>作者:青青<br>发表于2002-5-30 9:03:50<br>最后跟贴:什么都看不懂:......"
href="http://qingaaa.nnjh.com/dvbbs/dispbbs.asp?boardID=9&RootID=8&ID=8">复杂的奇怪的密码</A></TD>
</TR>
</TBODY>
</TABLE>
</BODY></HTML>
CnEve 2006-05-06
  • 打赏
  • 举报
回复
没理解LZ的具体用意,另日期转换可以这么写
DataBinder.Eval(Container.DataItem,"time","0:yyyy-MM-dd")
webwait 2006-05-06
  • 打赏
  • 举报
回复
http://blog.52forum.com/jyk/archive/2006/03/15/344.html
Lcindep110 2006-05-06
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/4562/4562210.xml?temp=2.434939E-02
显示标题过长则加...
这样一来就可以在
<a title="<%# DataBinder.Eval(Container.DataItem,"Title") %>" href="ReadNews.aspx?NewsID=<%# DataBinder.Eval(Container.DataItem,"NewsID") %>"target=_blank><font color="#cc3333">·</font> <%# SplitString(DataBinder.Eval(Container.DataItem,"Title").ToString(),20) %>…
</a>
日期可以<%# DataBinder.Eval(Container.DataItem,"Date",{0:d}) %>
sunchaohuang 2006-05-06
  • 打赏
  • 举报
回复
upup
hnghng 2006-05-06
  • 打赏
  • 举报
回复
可是,我的数据库中的"title"完整的标题是r_p2.gif中的标题。 还有阿数据绑定只有
DataBinder.Eval()一个方法么?谢谢了。
webwait 2006-05-06
  • 打赏
  • 举报
回复
1.根据r_p1.gif看,你的<%# DataBinder.Eval(Container.DataItem,"Title") %>就是
“我院召开....2005-2006”,应该不是你title的事情
2.没环境,分行的记不清了,css样式可以实现
3.日期可以用FormatString实现

62,254

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧