怎样控制字符的显示个数?希望两分钟分搞定,全靠各位大哥大姐了....... 一个gridview绑定数据后,每条记录的标题字数太多,比如有20个字,但列宽只能显示15个字,怎么让它少显示几个字数,然后用...代替呢?急,,,大家抓紧时间,,快下班了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%#DataBinder.Eval(Container.DataItem,"topic")%>前台是这样写的.怎么搞????????????????? #region 用“...”代替超长字符串调用的方法 public string SubStr(string sString, int nLeng) { if (sString.Length <= nLeng) { return sString; } string sNewStr = sString.Substring(0, nLeng); sNewStr = sNewStr + "..."; return sNewStr; } #endregion //处理备注这一行的数据 for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { DataRowView mydrv; string gIntro; if (GridView1.PageIndex == 0) { mydrv = ds.Tables[0].DefaultView[i];//表名 gIntro = Convert.ToString(mydrv["room_test"]);//所要处理的字段(备注这一列) GridView1.Rows[i].Cells[9].Text = SubStr(gIntro, 2); } else { mydrv = ds.Tables[0].DefaultView[i + (GridView1.PageSize * GridView1.PageIndex)]; gIntro = Convert.ToString(mydrv["room_test"]); //GridView1.Rows[i].Cells[9].TemplateSourceDirectory.Insert(i,gIntro); GridView1.Rows[i].Cells[9].Text = SubStr(gIntro, 2); } } 【提问】datareader如何取出来所有数据 js弹出提示框的问题 页面跳转时刷新顶部的iframe页该如何写。 文本框输入的问题?急 不知道是什么问题,请高手帮帮忙,头都晕了,谢谢!!(是一个用户注册页面) DataList设置首行数据颜色 求助过来人,我该怎么继续学习下去提高自己 怎样做一个登陆框比较好看,CSDN的那个样子就不错。 页面报错的问题。 ButtonColumn的问题 有关handler的问题 (急)高手进
前台是这样写的.怎么搞?????????????????
public string SubStr(string sString, int nLeng)
{
if (sString.Length <= nLeng)
{
return sString;
}
string sNewStr = sString.Substring(0, nLeng);
sNewStr = sNewStr + "...";
return sNewStr;
}
#endregion
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
DataRowView mydrv;
string gIntro;
if (GridView1.PageIndex == 0)
{
mydrv = ds.Tables[0].DefaultView[i];//表名
gIntro = Convert.ToString(mydrv["room_test"]);//所要处理的字段(备注这一列)
GridView1.Rows[i].Cells[9].Text = SubStr(gIntro, 2);
}
else
{
mydrv = ds.Tables[0].DefaultView[i + (GridView1.PageSize * GridView1.PageIndex)];
gIntro = Convert.ToString(mydrv["room_test"]); //GridView1.Rows[i].Cells[9].TemplateSourceDirectory.Insert(i,gIntro);
GridView1.Rows[i].Cells[9].Text = SubStr(gIntro, 2);
}
}