或者说保留前几个文字,然后跟一个 ... 符号请哪位知道的朋友指教一下,谢谢!有分(虽然我不知道我没有分可以给,不了解这个论坛的分数系统,haha..)
解决方案 »
- 关于类里边配置文件的问题,
- 求一正则表达式?貌似有点难度
- 垃圾人,断了奶就忘了娘,咋现在官都这样?
- (帮帮小妹吧!)如何将字符串存储的逻辑语句执行出结果!
- windows方式下如何查找iis的虚拟路径,求助!!!
- GDI+画出矩形的输出位置问题?路过高手请速进!谢谢
- private会出现这种情况?还是我那儿没有设置呢?请教
- 有人说.net红不起来的,还是JAVA、J2EE的好!大家来讨论讨论!
- 蔡鸟提问,在asp.net中,利用Response下载文件,在弹出的保存文件对话框中,文件扩展名种类为 “全部文件类型” 能做到吗?
- 如何在webform中画图(比如画线)。请说的详细点。谢了
- 关于treeview的问题
- 在数据库中int型值为0的数据在dataGrid中显示为空如何实现
<%# CutString(DataBinder.Eval(Container.DataItem, "xx").ToString())%>
后台
public string CutString(string SourseString)
{
if (SourseString.Length>10)
{
return SourseString.Substring(0,10)+"...";
}
else
{
return SourseString;
}
}
{
string i = e.Row.Cells[2].Text;
if (i.Length > 2)
{
e.Row.Cells[2].Text = i.Substring(0, 2) + "...";
}
}
{
int i = 0, j = 0;
foreach(char chr in str)
{
if((int)chr > 127)
{
i += 2;
}
else
{
i ++;
}
if (i > length)
{
str = str.Substring(0, j);
break;
}
j ++;
}
return str; }
<%#GetSubString(DataBinder.Eval(Container.DataItem,"Title").ToString(),len)%>
http://blog.ydqmx.net/user1/evil/archives/2006/1024.html
则 sql = 'select left(column2,20),column3,...from ... ';就可以了
sql = select left(column2,20)+'...',column3,...from ...;
{
s_temp=DRV["title"].ToString().Trim();
if (s_temp.Length>I_length)
{
DRV["title"]=s_temp.Substring(0,I_length)+"...";
}
}
return DV;
如果列是text,就left(Convert(varchar(n),列名),位数) '别名'
<asp:Label ID="Label1" runat="server" Text='<%# Bind("人员") %>'></asp:Label></div>
下面是样式
.my_nowrap
{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
e.item.cells(1).text=mid(e.item.cells(1).text,0,8) & "…"
endif1是你要设置的列的位置,8是你限制字符的长度
e.item.cells(1).text=mid(e.item.cells(1).text,0,8) & "…"
endif1是你要设置的列的位置,8是你限制字符的长度